JAVASCRIPT BASIC
JAVASCRIPT & DOM
JAVASCRIPT & BOM
JAVASCRIPT ADVANCED
JAVASCRIPT EXAMPLES
JAVASCRIPT REFERENCE

JavaScript Array Reference

This chapter contains a brief overview of the properties and method of the global array object.

The JavaScript Array Object

The JavaScript Array object is a global object that is used in the construction of arrays. An array is a special type of variable that allows you to store multiple values in a single variable.

To learn more about Arrays, please check out the JavaScript array chapter.

Array Properties

The following table lists the standard properties of the Array object.

Property Description
length Sets or returns the number of elements in an array.
prototype Allows you to add new properties and methods to an Array object.

Note: Every object in JavaScript has a constructor property that refers to the constructor function that was used to create the instance of that object.


Array Methods

The following table lists the standard methods of the Array object.

Method Description
concat() Merge two or more arrays, and returns a new array.
copyWithin() Copies part of an array to another location in the same array and returns it.
entries() Returns a key/value pair Array Iteration Object.
every() Checks if every element in an array pass a test in a testing function.
fill() Fill the elements in an array with a static value.
filter() Creates a new array with all elements that pass the test in a testing function.
find() Returns the value of the first element in an array that pass the test in a testing function.
findIndex() Returns the index of the first element in an array that pass the test in a testing function.
forEach() Calls a function once for each array element.
from() Creates an array from an object.
includes() Determines whether an array includes a certain element.
indexOf() Search the array for an element and returns its first index.
isArray() Determines whether the passed value is an array.
join() Joins all elements of an array into a string.
keys() Returns a Array Iteration Object, containing the keys of the original array.
lastIndexOf() Search the array for an element, starting at the end, and returns its last index.
map() Creates a new array with the results of calling a function for each array element.
pop() Removes the last element from an array, and returns that element.
push() Adds one or more elements to the end of an array, and returns the array's new length.
reduce() Reduce the values of an array to a single value (from left-to-right).
reduceRight() Reduce the values of an array to a single value (from right-to-left).
reverse() Reverses the order of the elements in an array.
shift() Removes the first element from an array, and returns that element.
slice() Selects a part of an array, and returns the new array.
some() Checks if any of the elements in an array passes the test in a testing function.
sort() Sorts the elements of an array.
splice() Adds/Removes elements from an array.
toString() Converts an array to a string, and returns the result.
unshift() Adds new elements to the beginning of an array, and returns the array's new length.
values() Returns a Array Iteration Object, containing the values of the original array.

Your Feedback:

We would love to hear from you, please drop us a line.