Top 20 JavaScript Array Methods

Top 20 JavaScript Array Methods

Table of contents

No heading

No headings in the article.

JavaScript provides Many array methods that allow you to manipulate and work with arrays in an efficient manner.

Here are 20 commonly used JavaScript array methods :

  1. concat(): Combines two or more arrays and returns a new array.

  2. join(): Joins all elements of an array into a string.

  3. pop(): Removes the last element from an array and returns it.

  4. push(): Adds one or more elements to the end of an array and returns the new length.

  5. shift(): Removes the first element from an array and returns it.

  6. unshift(): Adds one or more elements to the beginning of an array and returns the new length.

  7. slice(): Extracts a portion of an array into a new array.

  8. splice(): Adds or removes elements from an array at a specific index.

  9. reverse(): Reverses the order of the elements in an array.

  10. sort(): Sorts the elements of an array in place.

  11. filter(): Creates a new array with elements that pass a certain condition.

  12. map(): Creates a new array by applying a function to each element of an array.

  13. forEach(): Executes a provided function once for each array element.

  14. reduce(): Applies a function to reduce the array to a single value (from left to right).

  15. reduceRight(): This applies a function to reduce the array to a single value (from right to left).

  16. every(): Checks if all elements in an array pass a certain condition.

  17. some(): Checks if at least one element in an array passes a certain condition.

  18. indexOf(): Returns the first index at which a given element can be found in an array.

  19. lastIndexOf(): Returns the last index at which a given element can be found in an array.

  20. includes(): Checks if an array contains a certain element and returns true or false.

If You Want To Know How Every Array Method Works, Then Make Sure to watch this 40 Minute Video About Javascript Array Methods on Youtube