
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 33676 Articles for Programming

2K+ Views
This article will teach us how to write a swift program to find common array elements. So here we use the following methods − Using the filter method Using sets But before moving to the methods, we first understand common elements with the help of an example. Suppose we have two arrays − Arr1 = [2, 4, 6, 89, 78] Arr2 = [56, 88, 32, 4, 99, 89] So the common elements between two arrays are [4, 89]. Because they are available in Arr1 and Arr2. Method 1: Using filter(_:) Method To find common elements between two arrays ... Read More

311 Views
In this article, we will learn how to write a swift program to count the elements of an array. To count the elements of an array swift provide a count property. This property will return the total number of elements present in the specified array. For example − Arr = [3, 5, 6, 4, 6] so the count will return 5. Syntax var count: Int{get} Or you can also write it as − arrayName.count Here count is the property of the array to count the total elements present inside the array. To use this property we ... Read More

4K+ Views
In this article, we will learn how to write a swift program to check whether two arrays are equal. To check if two arrays are equal to not either, we are going to use the following two methods − using == operator elementsEqual(_:) method. Both method and operator return true if both the given array has the same elements. Otherwise, they will return false. For example, arr1 = [2, 3, 4, 5] and arr2 = [2, 3, 4, 5] both arrays are equal so both the method and operator will return true. arr1 = [2, 3, 4, ... Read More

4K+ Views
In this article, we will learn how to write a swift program to check if an array is empty. Here we use two methods: Using isEmpty property Using conditional statements Method 1: Using isEmpty Property To check if an array is empty Swift provides an isEmpty property. This property will return true if the given array is empty or return false if the given array is not empty. For example Arr = [3, 5, 6, 4, 6] so isEmpty property will return false. Syntax var isEmpty: Bool{get} Or you can also write it as − arrayName.isEmpty ... Read More

3K+ Views
In TypeScript, the type guards are used to determine a variable's type, often inside a conditional or functional block. The type guards usually take the variable and return a Boolean value or the variable type. Type guards allow you to tell the TypeScript compiler to infer a given type for a variable in a specific context, guaranteeing that an argument's type is what you say it is. Like feature detection, type guards are frequently used to limit a type and let you identify the proper prototypes, methods, and attributes of a value. As a result, handling that value became simple ... Read More

15K+ Views
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 More

9K+ Views
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 More

5K+ Views
In TypeScript, a 2D array is an array of arrays, where each inner array represents a row of the 2D array. You can access individual elements of the array using bracket notation, with the row and column indices separated by a comma. A single-dimensional array can store values of any data type, such as string, number, objects, etc. To sort a 2D array in TypeScript, you can use the sort() method along with a custom compare function. The sort() method takes the compare function as an optional argument, and the compare function should take two arguments, a and b, ... Read More

3K+ Views
In TypeScript, an array is a data type that represents a collection of elements. Each element in the array has a specific index, or position, in the array, and you can access or modify the elements in the array using their index. In TypeScript, an array can contain elements of the same or different data types. To push an element to the end of an array in TypeScript, you can use the push() method. This method adds the element to the end of the array and returns the new length of the array. Syntax Users can follow the syntax below ... Read More

4K+ Views
The string can contain a sequence of repeated and non-repeated characters. The length of the string means the total number of characters the string contains in the sequence of characters, including special characters, alphabetic characters, etc. Here, we will learn different methods to calculate the length of the string in TypeScript. Using the length property of the string In TypeScript, the string is a library, or we can say it is a class. It contains some properties and methods, which we can call by taking the string class object as a reference. The length is also the property of the ... Read More