8 Javascript array methods that you should know

imdadul ahmed
2 min readNov 2, 2020

--

Javascript arrays has become more fun to play with after ES6 as it has presented us with some very helpful methods that can really save up loads of our time. Lets talk about these methods in brief.

  1. Map():
    This method creates a new array by doing something with each item in the array. Lets see an example :

2. Filter():
This method creates a new array by keeping the items that fulfills the condition stated inside the function . Lets see an example :

3. Reduce():
This method accumulates and returns a value by doing something to each item in an array. Lets see an example :

4. Find():
This method finds the first item that matches the condition from an array and returns it. Lets see an example :

5. FindIndex():
This method finds the index of the first item that matches the condition from an array and returns it. Lets see an example :

6. Some():
This method tests whether at least one element in the array passes the condition provided in the function. It returns TRUE or FALSE. Lets see an example :

7. Every():
This method tests whether all elements in the array passes the condition provided in the function. It returns a Boolean value too. Lets see an example :

8.Includes():
This method determines whether an array includes a certain value among its entries and returns true or false accordingly. Lets see an example :

well, guess what!! you can even shorten this code using array function that is a blessing feature of the new ES6 of 2015. But that’s for another topic.

That was all for today ❤. Have a blast with your JS journey!!! YAY!!!

--

--

imdadul ahmed
0 Followers

Seeking a challenging yet rewarding career with a progressive organization that provides the opportunity for development.