Shubham Vora has Published 962 Articles

How to reverse the String in TypeScript?

Shubham Vora

Shubham Vora

Updated on 03-Jan-2023 12:22:05

9K+ Views

This tutorial demonstrates multiple ways to reverse a string in TypeScript. At first, reversing the string problem looks easy, but what if someone asks you to explain the different approaches to reversing a string in TypeScript? For example, what if the interviewer asks to reverse the words of the string ... Read More

How to replace substring in string in TypeScript?

Shubham Vora

Shubham Vora

Updated on 03-Jan-2023 12:18:52

954 Views

Sometimes, we need to replace a substring with a new string or any particular character while working with TypeScript. The simple way to replace the substring or part of the string is to use the replace() method. Here, we will create a custom algorithm to replace the string for the ... Read More

What is Type Assertion in TypeScript?

Shubham Vora

Shubham Vora

Updated on 03-Jan-2023 12:00:27

5K+ Views

Type assertion is a mechanism in TypeScript that informs the compiler of the variable type. We can override the type using a type assertion if TypeScript finds that the assignment is wrong. We must be certain that we are correct since the assignment is always legitimate when we employ a ... Read More

How to use typeof operator in TypeScript?

Shubham Vora

Shubham Vora

Updated on 03-Jan-2023 11:56:15

793 Views

In TypeScript, the typeof is one of the most helpful operators and keywords to check the types of variables or identifiers. However, TypeScript is a type-strict language. So, we need to define the type of the variable or object while defining the identifier itself. Still, sometimes we need to check ... Read More

How to specify optional properties in TypeScript?

Shubham Vora

Shubham Vora

Updated on 03-Jan-2023 11:53:53

1K+ Views

We will learn to specify the option properties in TypeScript. The true meaning of the optional property is that properties can be undefined or null, and we can initialize them whenever required. In real-time development, the importance of optional properties is very much. For example, we are fetching the data ... Read More

How to get substring in TypeScript?

Shubham Vora

Shubham Vora

Updated on 03-Jan-2023 11:51:17

477 Views

The string contains various characters, and the substring is the part of the string. We can get the substring from the string two ways. The first is using the starting and ending position of the substring, and the second is using the starting position and length of the substring. We ... Read More

How to find the natural logarithm of a number in TypeScript?

Shubham Vora

Shubham Vora

Updated on 03-Jan-2023 11:48:34

332 Views

The natural logarithm is the logarithm of any numeric value to the base e. Here e is Euler's constant, and the value of Euler’s constant is approximately 2.718. In TypeScript, we can use the built-in library methods to find the natural logarithm of any numeric value greater than or equal ... Read More

How to create an array of objects in TypeScript?

Shubham Vora

Shubham Vora

Updated on 03-Jan-2023 11:46:04

14K+ Views

In TypeScript, the array contains the data or different values and can also contain an object. The object contains the properties and methods in TypeScript. We can access the object properties and invoke the object method by taking the object as a reference. In this tutorial, we will learn to ... Read More

Explain Enum in TypeScript

Shubham Vora

Shubham Vora

Updated on 03-Jan-2023 11:39:00

474 Views

Before getting into “enum, ” it is essential to know about the popular keyword “const” in typescript. When we declare a variable "const", we cannot change the value assigned to it. So, enums are nothing but a collection of these const data types. We can create enums with the help ... Read More

How to find last occurence of element in the array in TypeScript?

Shubham Vora

Shubham Vora

Updated on 03-Jan-2023 11:33:46

3K+ Views

We will learn to find the last index of the element in the array in TypeScript. In development, an array of the data can contain duplicate data, and we may need to keep the last occurrence of the element. For example, we have fetched all users’ login history from the ... Read More

Advertisements