JavaScript Array Object

The Array is a globel object in JavaScript that allows you to store multiple elements at once.

The Array class in JavaScript is a list-like object. We can access the various properties and methods to perform different operations on the array. For example, the sort() method is used to sort the elements of an array.

JavaScript Array length

Returns the number of elements in an array

JavaScript Array reverse()

Returns the array in reverse order

JavaScript Array sort()

Sorts the elements of an array in specific order

JavaScript Array fill()

Returns array by filling elements with given value

Javascript Array join()

Concatenates the array elements to a string

Javascript Array toString()

Returns the string representation of an array

JavaScript Array pop()

Removes and returns the last array element

JavaScript Array shift()

Removes and returns the first array element

JavaScript Array push()

Adds elements to end of array & returns its length

JavaScript Array unshift()

Adds elements to start of array and returns length

JavaScript Array concat()

Returns array by merging given value and/or arrays

JavaScript Array splice()

Returns an array by changing its elements in place

JavaScript Array lastIndexOf()

Returns the last index of occurrence of an element

JavaScript Array indexOf()

Returns the first index of occurrence of element

JavaScript Array of()

Creates a new Array instance from given arguments

JavaScript Array slice()

Returns a shallow copy of a portion of an array

JavaScript Array findIndex()

Returns index of element that satisfies condition

JavaScript Array find()

Returns first element that satisfies a condition

JavaScript Array includes()

Checks if a value exists in an array

Javascript Array reduceRight()

Reduces array to single value from right to left

Javascript Array reduce()

Reduces array to single value from left to right

Javascript Array isArray()

Checks if the given value is a JavaScript Array

Javascript Array filter()

Returns array by filtering elements on given test

JavaScript Array map()

Returns array by mapping elements using given func

Javascript Array forEach()

Executes the given function on array elements

Javascript Array some()

Tests if any element passes given test function

Javascript Array every()

Tests if all elements pass the given test function

Javascript Array entries()

Returns iterator containing key/value pair array

JavaScript Array keys()

Returns an iterator containing keys of array items

JavaScript Array values()

Returns iterator containing values of array items

Javascript Array.from()

Creates a new Array from array-like object

Javascript Array constructor

Returns the constructor function for the array

Javascript Array copyWithin()

Copies and overwrites elements within the array

Javascript Array toLocaleString()

Returns string representing the elements of array

JavaScript Array flat()

Flattens the nested array to given depth

JavaScript Array flatMap()

Returns new array by mapping and flattening array