Articles in this series
The main purpose of forEach method is it executes a provided function once for each array element. In other words, iterates over the array. Often used in functional programming. Always returns undefined. // SYNTAX: arr - The array forEach is itera...
After a long time, a new post on JavaScript methods is here... Let's learn about the indexOf() method. indexOf() It accepts two parameters: The required parameter of searchValue indicates the content you want to search for in a string. The optiona...
The some() method tests whether at least one of the elements in the array passes the test implemented by the provided function. The result of the some() method is a boolean. Let's see the syntax:- const new = array.some(( v, i, a) => { // ...
The reduce() method is used to apply a function to each element in the array to reduce the array to a single value.Let's see the syntax:- let result = array.reduce((acc, v, i, a) => { // return the new value to the result variable }, initVal); /...
The filter() method creates a new array filled with all the elements of the old array that pass a certain test, provided as a function. Let's take a look at the syntax:- let new = array.filter((v, i, a) => { // return element to new if condition...
JavaScript methods are actions that can be performed on objects. So here is my new blog post I will cover the two JavaScript methods map() and filter(). Will explain easily and in detail. map() -> The map() method is used to apply a function on e...