Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Articles by Shubham Vora
Page 47 of 80
Method Overriding in TypeScript?
The method overriding means writing the new definition of the method in the inherited class by keeping the method name, parameters, and return type the same. In this tutorial, we will learn about the method overriding in TypeScript. Inheritance is one of the four pillars of object-oriented programming. The method overriding feature of the OOPs is helpful with the inheritance. For example, we can define the method in the parent class and redefine the method with the same name, parameter, and return type into the base class with a different code to execute, and that’s how method overriding comes into ...
Read MoreHow to use getters and setters in TypeScript?
In TypeScript, the getters and setters are two terms that can be used to get and set the value of the class members, respectively. However, users can access the public members of the class directly via the dot operator by taking the object of the particular class as a reference. To access the class's private members, we just need to use the getter method. In this tutorial, we will learn to use the getters and setters in TypeScript. Using the getters to access the private members of the class As we create a method to access the class's private ...
Read MoreHandling Errors in TypeScript
Functional programming languages such as TypeScript and JavaScript provide a way to handle errors using the try-catch blocks. The try block catches the errors, and the catch block handles the errors. In this tutorial, we will learn to handle errors in TypeScript. There are mainly 7 types of errors in TypeScript. Here, we will learn all types of errors one by one. Range error − If we try to access anything out of range, TypeScript will throw a range error. For example, accessing the array index for a large number value such as 10^100. Reference error − If we ...
Read MoreHow to implement class constants in TypesScript?
In this tutorial, we will learn to implement class constants in TypeScript. Any application has shared values that need to be used by classes and modules. These numbers could be configuration parameters, environment settings, error codes, or status indications. Using constants to hold those values rather than hard-coding magic strings is recommended. Constant use makes a program manageable by preventing the repetition of values in different places. Object-oriented JavaScript is TypeScript. Classes, interfaces, and other object-oriented programming are supported by TypeScript. In terms of OOP, a class is a template for building objects. The object's data is contained within a ...
Read MoreHow to push an element at the beginning of an array in TypeScript?
In this tutorial, we will learn to push the elements at the start of the array in TypeScript. There are different ways to push single or multiple elements at the start of the array in TypeScript. Here, we will learn three different methods to push array elements at the array's starting index. Using the Array.unshift() Method The Array.unshift() method of TypeScript allows us to add the element into the array at the beginning. Also, we can add multiple elements at the start of the array using the Array.unshift() method. Syntax Users can follow the syntax below to use the array.unshift() ...
Read MoreHow to override multiple if-else conditions using a switch statement in TypeScript?
In this tutorial, we will learn to override the multiple if-else conditions using the switch case statement in TypeScript. The single if-else statement is used to execute the condition statement. If the condition becomes true, the statement of if block executes otherwise control fallbacks to the else block and executes its statement. In some cases, developers must execute the code blocks on different conditions. For that, they require to write multiple if-else statements of ladder of if-else statements. Here, we will convert that ladder of if-else statements to switch case statements. Converting If-else conditions to Switch Statement in TypeScript Here, ...
Read MoreHow to find the total number of elements in an array in TypeScript?
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 MoreHow to filter values from an array in TypeScript?
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 MoreHow to invoke methods of a particular class in TypeScript?
In this tutorial, users will learn to invoke a particular class method in TypeScript. The class is the basic concept of object-oriented programming. In simple terms, it contains member variables and methods we can access by creating the object of that particular class. So, class is the blueprint of the objects we create for that particular class. The class can contain the functions in TypeScript, and we can also call them to the method. So, users need to learn to access and invoke the method of the particular class. Invoking the method of a particular class in TypeScript In TypeScript, ...
Read MoreHow to send FormData objects with Ajax-requests in jQuery?
In this tutorial, we will learn How to send FormData objects with Ajax requests in jQuery. The FormData object stores value in the form of key-value pair. It mainly sends form data to the server with HTTP requests. If the form’s encoding type had been set to multipart/form-data, the submitted data would have been sent similarly via the submit() function. The FormData object contains multiple operations methods such as append, delete, set, etc. Syntax const formData = new FormData() formData.append('key', 'value') Users can follow the above syntax to create a FormData object. Asynchronous JavaScript And XML are referred to ...
Read More