A few words of thanks would be greatly appreciated.

Javascript - The Array object

The Array object is one of the JavaScript core objects, allowing you to create and manipulate arrays.

Here is the syntax for creating an array:

var x = new Array(element1[, element2, ...]);

If no element is specified as a parameter, an empty array is created. Otherwise, it will be initialized with the values ??passed as parameters (element1,element2...).

The Array object has two characteristic properties: the input and length properties.

The following table describes the properties of the Array object.

constructorThis property contains the constructor of the Array object.
inputThis property allows you to search the array using a regular expression
lengthThis property contains the number of array elements.
prototypeAllows you to add custom properties to the object.

The following table describes the methods of the Array object.

concat(array1, array2[, array3, ...])This method allows to concatenate multiple arrays
join(array) or Array.join()This method returns a string containing all the elements of the array.
pop(array) or Array.pop()This method removes the last element of the array and returns its value.
TArray.push(value1[, value2, ...])This method sums up one or more elements of the array.
Array.reverse()This method reverse the order of the elements in the array.
Array.shift()This method removes the first element of the array.
Array.slice()This method returns an array containing part of the elements of an array.
Array.splice()This method adds / removes elements from an array.
Array.sort()This method is used to sort the elements of an array..
Array.unshift(value1[, value2, ...])This method returns the source code that has created the Array object.
Array.toString()This method returns the string corresponding to the instruction that helped create the Array object.
Array.unshift()This method allows to add one or more elements to the beginning of the table.
Array.valueOfThis method simply returns the value of the Array object to which it refers.

Original document published on CommentcaMarche.net

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
This document, titled « Javascript - The Array object », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).