ECMAScript 3 defines a number of useful array manipulation
prototype, which means that they are
available as methods of any array. These ECMAScript
3 methods are introduced in the subsections below. As usual,
complete details can be found under
Array in the client-side reference section.
ECMAScript 5 adds new array iteration methods; those methods are
covered in ECMAScript 5 Array Methods.
converts all the elements of an array to strings and concatenates
them, returning the resulting string. You can specify an optional
string that separates the elements in the resulting string. If no
separator string is specified, a comma is used. For example, the
following lines of code produce the string “1,2,3”:
// Create a new array with these three elements
// => "1,2,3"
// => "1 2 3"
// => "123"
// An array of length 10 with no elements
// => '---------': a string of 9 hyphens
Array.join() method is
the inverse of the
method, which creates an array by breaking a string into
reverses the order of the elements of an array and returns the
reversed array. It does this in place; in other words, it doesn’t
create a new array with the elements rearranged but instead
rearranges them in the already existing array. For example, the
following code, which uses the
join() methods, ...