Found 128 Articles for TypeScript

How to format strings in TypeScript?

Shubham Vora
Updated on 14-Sep-2023 02:35:36

33K+ Views

In this tutorial, we will learn to format the strings in TypeScript. The string is the sequence of characters in any programming language, and the same goes for TypeScript. In TypeScript, strings are immutable. The meaning of the immutable is that we can’t change the string character at the particular index, but we can append the character to the string. Below, we will learn different methods to format the string in TypeScript. Using the + operator to merge two or more strings Generally, the '+' operator performs the addition operation of two or more numbers. When we use the + ... Read More

How to find the total number of elements in an array in TypeScript?

Shubham Vora
Updated on 16-Dec-2022 17:35:27

17K+ Views

In this tutorial, we will learn to find the total number of elements in the array. In TypeScript, the array is the data structure containing various elements such as integers, strings, objects, etc. While working with the APIs and performing operations with the data often requires counting the total number of elements in the array. Also, sometimes it requires counting the number of elements in the array based on certain conditions. Here, we have focused on various methods to count a total number of elements in the array. Using the length property of the array in TypeScript The array prototype ... Read More

How to filter values from an array in TypeScript?

Shubham Vora
Updated on 16-Dec-2022 17:34:13

9K+ Views

In this tutorial, users will learn to filter the values from the array in TypeScript. The filter is an important operation to manipulate the data we get from the database. For example, everyone has seen the filter on the Amazon, Flipkart, etc. websites to filter the products according to different criteria. To create something like that, either we can get the filtered data from the database directly, or we can get the whole data and filter at the frontend side from the array of the products, and it depends on some criteria such as database size, performance, etc. Use the ... Read More

How to perform string comparison in TypeScript?

Shubham Vora
Updated on 10-Sep-2023 08:16:41

35K+ Views

In this TypeScript tutorial, users will learn to make string comparisons. The string comparison is the basic operation required while working with any programming language. Suppose we are developing a web or Android application and need to compare string data such as user id, user name, password, etc. In such cases, string comparison becomes very useful. Using the strict equality (===) operator The best way to compare the strings in TypeScript is to use the strict equality operator. The strict equality operator first checks the types of the left and right operands, and if it matches, it compares the value ... Read More

How to convert string to lowercase in TypeScript?

Shubham Vora
Updated on 16-Dec-2022 17:31:22

1K+ Views

In this tutorial, we will learn to convert a string into lowercase in TypeScript. Converting string to lowercase is a basic operation, but it is useful many times. We can think about implementing the search functionality in the app. When users search for any phrase or word in lowercase, uppercase, or mixed case, we need to convert the string into lowercase and then execute the search query in the database to find the related items. Using the toLowerCase() Method The toLowerCase() method allows us to convert all alphabetic characters of the string into lowercase. If a character is in uppercase, ... Read More

How to compile a Typescript file?

Mayank Agarwal
Updated on 22-Apr-2022 13:44:46

1K+ Views

In this article are going to explore TypeScript and how to execute the same. TypeScript is an open-source programming language developed and maintained by Microsoft.Typescript is a bit syntactically different from the native JavaScript but also adds additional features to it. Typescript is the superset of JavaScript with a strong pace of development and object-oriented programming. It also does not run directly on the web browsers as JavaScript runsTypescript files need to be combined with JavaScript first and then they work as normal JavaScript. In order to compile and execute the typescript file, we need to install the node and ... Read More

Difference between TypeScript and JavaScript

Kiran Kumar Panigrahi
Updated on 25-Aug-2022 12:53:24

1K+ Views

Both TypeScript and JavaScript are used at the client-end for processing the server requests and rendering data on UI. Both are scripting languages, however Typescript supports some additional features, due to which it is sometimes regarded as the superset of JavaScript. Read through this article to find out more about TypeScript and JavaScript and how these two languages are different from each other. What is JavaScript? JavaScript is most often used as a component of webpages. Its webpage implementations enable client-side script to interact with the user and create dynamic sites. It is a programming language that is ... Read More

What is the relationship between JavaScript, CoffeeScript, TypeScript, ES5, and ES6?

radhakrishna
Updated on 30-Jul-2019 22:30:20

90 Views

JavaScriptThe base programming language in all these. ES5 and ES6 are just different versions of this languageCoffeeScriptCoffeeScript is a programming language which transcompiles to JavaScript. It’s a compiler layer on top of JavaScript.TypeScriptA language that compiles down to JavaScript. TypeScript is a method to create JavaScript code by writing it in the TypeScript dialect and compiles to JavaScript. TypeScript is a superset of JavaScript.ES5 and ES6CoffeeScript & TypeScript are the ones that support ES6 features. The compiler convert code into JavaScript (ES5). ES6 is next generation JavaScript.

Advertisements