Table of contents
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 :
concat()
: Combines two or more arrays and returns a new array.join()
: Joins all elements of an array into a string.pop()
: Removes the last element from an array and returns it.push()
: Adds one or more elements to the end of an array and returns the new length.shift()
: Removes the first element from an array and returns it.unshift()
: Adds one or more elements to the beginning of an array and returns the new length.slice()
: Extracts a portion of an array into a new array.splice()
: Adds or removes elements from an array at a specific index.reverse()
: Reverses the order of the elements in an array.sort()
: Sorts the elements of an array in place.filter()
: Creates a new array with elements that pass a certain condition.map()
: Creates a new array by applying a function to each element of an array.forEach()
: Executes a provided function once for each array element.reduce()
: Applies a function to reduce the array to a single value (from left to right).reduceRight()
: This applies a function to reduce the array to a single value (from right to left).every()
: Checks if all elements in an array pass a certain condition.some()
: Checks if at least one element in an array passes a certain condition.indexOf()
: Returns the first index at which a given element can be found in an array.lastIndexOf()
: Returns the last index at which a given element can be found in an array.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