How to compare strings for sorting in typescript

compare strings for sorting in typescript

In this typescript tutorial, we will see how to compare strings for sorting in typescript by using different methods. The methods are: Compare strings for sorting in typescript using localeCompare() method Here we will see how to compare strings for sorting using the localeCompare() method in typescript. In sorted order, the localeCompare method in typescript … read more…

How to Get Key by Value from enum String in Typescript

enum gets key by string value in typescript by using for...in loop

In this typescript tutorial, we will see how to get key by value from enum string in Typescript by using different methods. These methods are: Read: How to push an object into an array in Typescript Using Object.value, indexOf(), and Object.key Here we will see how to use Object.value(), indexOf(), and Objeck.key() to enum gets … read more…

How to push an object into an array in Typescript

push an object into an array using Push()

In this typescript tutorial, we will see how to push an object into an array in typescript using different methods. Below are the 3 methods to push an object into an array in Typescript: Push an object into an array in Typescript using Push () Here we will see how we can use push() in … read more…

How to get string between 2 characters in Typescript

Get string between 2 characters in Typescript

In this typescript tutorial, we will see how to get string between 2 characters in typescript using different methods. For example, the string is, Mindvalley-Afest#2023, the first character is – and the second character is #, so the between string is ‘Afest’. These are the methods to get string between 2 characters in Typescript: Get … read more…

How to convert string to double in typescript

convert string to double in typescript

In this typescript tutorial, we will see how to convert string to double in typescript, using different methods. Below are the 3 methods to convert string to double in typescript: For example, if the string is “21.44”, we will convert it to double then it returns 21.44(without quotes). Note that in typescript integers, floating point … read more…

How to get string after character in Typescript

Get string after character in Typescript

In this typescript tutorial, we will see how to get string after character in typescript using different methods. For example, the string is “fest-2020”, then the character is ‘-‘, and after that, the string is 2020. Here are the 5 methods to get string after character in Typescript that we are going to cover: Get … read more…

Typescript string enum reverse mapping

string enum reverse mapping in Typescript

In this typescript tutorial, we will see what is an enum and string enum. Also, we will see how to do reverse mapping for string enums. The topics we are going to cover: What is an enum in typescript? An enum in TypeScript is a unique data type that allows us to create a set … read more…

Sort array of objects in typescript [With 10 examples]

Sort array of objects in typescript

In this typescript tutorial, we will see how to sort an array of objects in typescript. We will cover different examples: What is sorting an array of objects in typescript? In TypeScript, sorting an array of objects means arranging the array’s items in a certain order depending on the values of one or more attributes … read more…

How to check if string contains only numbers in typescript

Check if string contains only numbers in typescript

In this typescript tutorial, we will see how to check if the string contains only numbers in typescript. To check if string contains only numbers in typescript by using different methods: Using the isNaN() function in typescript Here we will see how to check if string contains only numbers by using the isNaN() function in … read more…

Typescript convert string to keyof [4 examples]

Keyof in typescript

In this typescript tutorial, we will see how to convert string to keyOf in typescript. We will see different examples to convert string to keyOf in typescript. Here are the topics we are going to cover: What is keyOf in typescript? The keyOf in typescript is a keyword, which is used to create a union … read more…

Typescript string capitalize first letter [Using 4 methods]

Typescript string capitalize first letter

In this typescript tutorial, we will see how to capitalize the first letter of a string in typescript. There are four methods in typescript to capitalize the first letter of the string: Using charAt and toUpperCase Here we will see how we can capitalize the first letter of a string in typescript using the charAt … read more…

>