JavaScript includes a small set of standard methods that are available on the standard types.
array.concat(item...)
2 var b = ['x', 'y', 'z'];
3 var c = a.concat(b, true);
array.join(separator)
2 a.push('d');
3 var c = a.join(''); // c is 'abcd';
array.pop( )
2 var c = a.pop( ); // a is ['a', 'b'] & c is 'c'
array.push(item...)
2 var b = ['x', 'y', 'z'];
3 var c = a.push(b, true);
4 // a is ['a', 'b', 'c', ['x', 'y', 'z'], true]
5 // c is 5;
array.reverse( )
2 var b = a.reverse( );
3 // both a and b are ['c', 'b', 'a']
array.shift( )
2 var c = a.shift( ); // a is ['b', 'c'] & c is 'a'
array.slice(start, end )
2 var b = a.slice(0, 1); // b is ['a']
3 var c = a.slice(1); // c is ['b', 'c']
4 var d = a.slice(1, 2); // d is ['b']
array.sort(comparefn )
2 n.sort( );
3 // n is [15, 16, 23, 4, 42, 8]
array.splice(start, deleteCount, item...)
var r = a.splice(1, 1, 'ache', 'bug');
// a is ['a', 'ache', 'bug', 'c']
// r is ['b']
array.unshift(item...)
2 var r = a.unshift('?', '@');
3 // a is ['?', '@', 'a', 'b', 'c']
4 // r is 5