JavaScript Array Playground


Array.filter()Pure

Creates a new array with all elements that pass the test implemented by the provided function. More








Array.find()Pure

Returns the value of the first element in the array that satisfies the provided testing function. Otherwise undefined is returned. More





Array.findIndex()Pure

Returns the index of the first element in the array that satisfies the provided testing function. Otherwise -1 is returned. More





Array.map()Pure

Creates a new array with the results of calling a provided function on every element in the calling array. More







Array.reduce()Pure

Applies a function against an accumulator and each element in the array (from left to right) to reduce it to a single value. More






Array.filter().map()

Two method can put together.



Array.sort()Impure

Sorts the elements of an array and returns the array. We can define the conditions for sorting. More






Array.reverse()Impure

Reverses an array in place. More





Array.push()Impure

Adds one or more elements to the end of an array and returns the new length of the array. More





PushPure

We can pure push too.




Array.shift()Impure

Removes the first element from an array and returns that removed element. This method changes the length of the array. More





Array.pop()Impure

Removes the last element from an array and returns that element. This method changes the length of the array. More





Array.splice()Impure

Changes the contents of an array by removing existing elements and/or adding new elements. More





Array.join()Pure

Joins all elements of an array (or an array-like object) into a string and returns this string. More




Array.concat()Pure

This method is used to merge two or more arrays. This method does not change the existing arrays, but instead returns a new array. More





Array.slice()Pure

Returns a shallow copy of a portion of an array into a new array object selected from begin to end (end not included). The original array will not be modified. More





Array.toString()Pure

Returns a string representing the specified array and its elements. More



Copy ArrayPure

pure Copy Array




Array.copyWithin()Impure

Shallow copies part of an array to another location in the same array and returns it, without modifying its size. More




Array.entries()Pure

Returns a new Array Iterator object that contains the key/value pairs for each index in the array. More



Array.every()Pure

Tests whether all elements in the array pass the test implemented by the provided function. More



Array.fill()Impure

Fills all the elements of an array from a start index to an end index with a static value. The end index is not included. More





Array.find()Pure

Returns the value of the first element in the array that satisfies the provided testing function. Otherwise undefined is returned. More



Array.forEach()Pure

Executes a provided function once for each array element. More



Array.includes()Pure

Determines whether an array includes a certain element, returning true or false as appropriate. It uses the sameValueZero algorithm to determine whether the given element is found. More





Array.from()Pure

Creates a new, shallow-copied Array instance from an array-like or iterable object. More



Array.isArray()Pure

Determines whether the passed value is an Array. More



Array.of()Pure

Creates a new Array instance with a variable number of arguments, regardless of number or type of the arguments. More



Array.indexOf()Pure

Returns the first index at which a given element can be found in the array, or -1 if it is not present. More





Array.keys()Pure

Returns a new Array Iterator object that contains the keys for each index in the array. More



Array.lastIndexOf()Pure

Returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards, starting at fromIndex. More





Array.map()Pure

Creates a new array with the results of calling a provided function on every element in the calling array. More



Array.reduceRight()Impure

Applies a function against an accumulator and each value of the array (from right-to-left) to reduce it to a single value. More



Array.some()Pure

Tests whether at least one element in the array passes the test implemented by the provided function. More



Array.toLocaleString()Pure

Returns a string representing the elements of the array. The elements are converted to Strings using their toLocaleString methods and these Strings are separated by a locale-specific String (such as a comma “,”). More



Array.unshift()Impure

Adds one or more elements to the beginning of an array and returns the new length of the array. More



Array.values()Pure

Returns a new Array Iterator object that contains the values for each index in the array. More



Array[Symbol.iterator]()Pure

Property is the same function object as the initial value of the values() property. More



Star    Fork

Made with 🍺 and vue.js.