- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 128 Articles for TypeScript
2K+ Views
In TypeScript, classes are the template that defines the variables and methods. We can use class templates to create objects, which means the class is the reusable component in object-oriented programming, and we can reuse it by creating its object. We can use the ‘interface’ keyword to define the interfaces in TypeScript. The interface contains the class structure. The interface is similar to abstract classes we define in other programming languages, such as Java and C++. It contains only the declaration of variables with their type and method with its return type and parameter types. Classes define the interface's methods ... Read More
3K+ Views
In TypeScript, ‘null’ refers to the data type or value. The null is a keyword in TypeScript, which we can use to represent the absent or empty value. So, we can use ‘null’ to define the variable's data-type or initialize the variable. In this tutorial, we will learn the different use cases of the null value and data type in TypeScript. Syntax Users can follow the syntax below to use the null keyword as a data type or value. let null_var: null = null; In the above syntax, ‘null’ refers to the data type of the null_var named ... Read More
3K+ Views
If you have worked with other programming languages, such as Python, you have heard about lambda functions. The arrow function is similar to the lambda function, which provides a shorter way to define the function inside TypeScript. We can create the function without a ‘function’ keyword by using the fat arrow and storing it inside the variable. After that, we can use that variable to invoke the function whenever required. Also, the arrow function doesn’t have any identity, as it is anonymous. So, we can identify it using the variable in which we have stored it. Syntax Users ... Read More
20K+ Views
In TypeScript, while working with the array, we often require to search for a particular element. To search for an element, either we can use the naive approach using the for loop or some built-in method such as the find() or indexOf() method. Also, we will learn to find the particular object in the array based on the object property. Using the for-of Loop to Search a Particular Element in The Array The naive approach to searching for an element is using linear search. In linear search, we need to iterate through the array using the for loop and check ... Read More
8K+ 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 rather than reversing every character of the string? Here, we will learn to reverse every character or word of the string in TypeScript. Using the for-of Loop to Reverse a String in TypeScript The naive approach to reverse the string uses the normal for loop or for-of loop. Here, we ... Read More
830 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 interview purpose of the beginners. However, we will also see the replace() method at last in this tutorial. Create the Custom Algorithm to Replace the Substring We will use the for loop to iterate through the main string in this part. We will use the substr() method of the string ... Read More
2K+ Views
The array stores the elements of the different data types in TypeScript. It is a collection of elements we can use it to store and access data whenever required. While working with multiple arrays, we need to combine two or more arrays. There are several ways to combine multiple arrays in TypeScript, and we will look through all ways in this TypeScript tutorial. Also, we will discuss when we should use which way is the best at last. Uing The For Loop to Join The Two Arrays We can follow the traditional way of using the for-of loop to join ... Read More
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 type assertion. If not, our program might not operate properly. Declaratively informing the compiler that we intend to regard the item as a distinct type is known as type assertion. Using this, we can regard any as a number or a number as a string. When moving code from JavaScript ... Read More
717 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 the type of the variable. For example, we are taking the data from the user via forms and handling it via TypeScript. Then we have to validate the data and perform some database operations. Also, the identifier can have multiple types in TypeScript. So, using the typeof operator, we can ... Read More
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 from the API and performing some operations on the data. If you try to use the data without getting it due to the database server being down or if there is any other problem, it will raise an error. In such case, we can make the data property optional and ... Read More
To Continue Learning Please Login
Login with Google