The most used JavaScript array methods

Siful Islam
2 min readNov 3, 2020

--

Javascript array methods

Whenever I try to make something using JavaScript, I have to use some of those methods. I am going to demonstrate the most used JS array methods.

  1. concat: Concat method marge two arrays and produce a new array. Remember it doesn't replace the existing arrays.
  2. every: Every method returns a boolean value. Either it will be true or false. Every method checks the conditions that all the values passed on the array match with the conditions.
  3. filter: Filter is the most used array method in JS. Filter methods take the arrays and return a new array after checking the conditions.
  4. find: Find returns the first element of the array which fulfill the condition. It returns a number.
  5. findIndex: FindIndex returns the first index of the array which fulfill the condition. It also returns a number.
  6. forEach: forEach return array values once for every elements. Note, It does not return values.
  7. indexOf: If you need to find an index of a value this method perfect for that.
  8. join: Join method return a string of all elements of the array. You can separate elements using space, comma, hyphens, etc.
  9. map: Map works the same as forEach but the only difference is map create a new array then show every element.
  10. lastaIndexOf: This method returns the last index number of the provided elements on the array. If it does not found it will return -1.
  11. pop: The pop method removes the last elements of that array and returns it.
  12. push: The push method adds a new element to the array and returns the new length.
  13. reduce: reduce the return of a new output of array and provided function results.
  14. sort: sort method returns the sorted array. we can sort ascending or descending. the default sort is ascending. First, it converts elements into a string than compare it to UTF-16 code unit values.

If you came this far that's mean you read the whole post. Thank you.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Siful Islam
Siful Islam

No responses yet

Write a response