How to Change Values in an Array when Doing foreach Loop in JavaScript ?
The forEach loop in JavaScript is one of the several ways to iterate through an array. ForEach method is different from all other looping methods as it passes a callback function for each element in the array....
read more
How to Remove duplicate elements from array in JavaScript ?
In this article, we will discuss the methods to remove duplicate elements from a Javascript array. There are various methods to remove duplicates in the array....
read more
Transpose a two dimensional (2D) array in JavaScript
Given a 2D array (matrix) and the task is to get the transpose of the matrix using JavaScript....
read more
Max/Min value of an attribute in an array of objects in JavaScript
In this article, we are given an array of objects and the task is to get the maximum and minimum values from the array of objects. For this approach, we have a few methods that will be discussed below....
read more
How to use arrays to swap variables in JavaScript ?
The technique of swapping two variables in coding refers to the exchange of the variables’ values. In an array, we can swap variables from two different locations. There are innumerable ways to swap elements in an array. let’s demonstrate a few ways of swapping elements such as:...
read more
How to find the longest word within the string in JavaScript ?
To find the longest word within the string in JavaScript we will compare the counts to determine which word has the most characters and return the length of the longest word....
read more
How to get a number of vowels in a string in JavaScript ?
The Approach of this article is to return the number of vowels in a string using Javascript. A vowel is also a letter that represents a sound produced in this way: The vowels in English are a, e, i, o, u....
read more
JavaScript Program to Reverse Digits of a Number
In this article, we are going to learn about Reverse Number Programs in JavaScript. A reverse number in JavaScript involves reversing the digits of a given number. It’s done by manipulating the digit’s order, resulting in the number’s reversed form....
read more
How to get nth occurrence of a string in JavaScript ?
In this article, the task is to get the nth occurrence of a substring in a string with the help of JavaScript. We have many methods to do this some of which are described below:...
read more
How to find the index of all occurrence of elements in an array using JavaScript ?
The index of all occurrences of elements refers to the positions of each instance of a specific element within an array. We find these indices to locate all occurrences of an element for various operations like counting, filtering, or manipulation within the array....
read more
Converting JavaScript Arrays into CSVs and Vice-Versa
Converting Arrays into CSVs: Given an array in JavaScript and the task is to obtain the CSVs or the Comma Separated Values from it. Now, JavaScript being a versatile language provides multiple ways to achieve the task....
read more
How to group objects in an array based on a common property into an array of arrays in JavaScript ?
In this article, we will try to understand how we may easily group objects in an array based on a common property into an array of arrays in JavaScript with the help of an example itself. Grouping objects in an array based on a common property into an array of arrays in JavaScript. Organize data by shared property for efficient data manipulation....
read more