Resin 1.1
FAQ
Reference
JavaDoc
Demo
Java Tutorial
Getting Started
Configuration
Topics
JSP
XTP/XSL
JavaScript
JS Library
Core Library
File Library
Servlet Library
Database Library
XML Library
Global
Object
Array
Boolean
Date
Function
Math
Number
Regexp
String
The Array Object
Array Constructor
Array(n) | Creates an array of length n.
Array(v1, ..., vn) | Creates an array of length n with initial values v1 through vn.
new Array(v1, ..., vn) | Same as `Array(v1, ..., vn])`
Array Instance
length | The length of the array.
join([separator]) | Returns a string concatenating the elements of the array separated by separator.
reverse() | Returns a new array by reversing the elements of the array.
sort() | Returns a new array sorting the array.
concat(a1, ..., an) | Returns a new array concatenating `this` with a1 through an.
pop() | Pops the last element off the array, returning the element.
push(v1, ..., vn) | Pushes new elements on the end of the array, returning the new length.
shift() | Shifts an element from the start of the array, returning the element.
unshift(v1, ..., vn) | Adds new elements to the front of the array, returning the new length.
slice(begin [, end]) | Returns a slice of the array.
splice(begin, len, v1, ..., vn) | Removes len elements from the array at begin, and adds the values v1 through vn at begin.
Array Constructor
### Array(n)
Creates an array of length n.
### Array(v1, ..., vn)
Creates an array of length n with initial values v1 through vn. If there is only a single argument, the other version of the constructor is used.
### new Array(v1, ..., vn)
Same as `Array(v1, ..., vn])`
Array Instance
### length
The length of the array.
### join([separator])
Returns a string concatenating the elements of the array separated by separator. If separator is omitted, ',' is used as a default.
[1,2,3].join(':')
1:2:3
See split
### reverse()
Returns a new array by reversing the elements of the array.
[1,,3,4].reverse()
4,3,,1
### sort()
Returns a new array sorting the array.
[4,9,2,,1,9,,7].sort().toSource()
[1, 2, 4, 7, 9, 9, , ,]
### concat(a1, ..., an) | ### JavaScript 1.2
Returns a new array concatenating `this` with a1 through an.
["a", "b"].concat({1:1, 0:0, length:2}, [5, 6])
a,b,0,1,5,6
### pop() | ### JavaScript 1.2
Pops the last element off the array, returning the element.
a = [1,2,3] a.pop() + ' ' + a
3 1,2
### push(v1, ..., vn) | ### JavaScript 1.2
Pushes new elements on the end of the array, returning the new length.
a = [1,2,3] a.push(4, 5) + ' ' + a
5 1,2,3,4,5
### shift() | ### JavaScript 1.2
Shifts an element from the start of the array, returning the element.
a = [0, 1, 2] a.shift() + ' ' + a.toSource()
0 [1, 2]
### unshift(v1, ..., vn) | ### JavaScript 1.2
Adds new elements to the front of the array, returning the new length.
a = [0, 1, 2] a.unshift(3, 4) + ' ' + a.toSource()
5 [3, 4, 0, 1, 2]
### slice(begin [, end]) | ### JavaScript 1.2
Returns a slice of the array. If begin or end are negative, they count from the end of the array.
[0, 1, 2, 3, 4].slice(1, -1)
1,2,3
### splice(begin, len, v1, ..., vn) | ### JavaScript 1.2
Removes len elements from the array at begin, and adds the values v1 through vn at begin. `splice` returns an array containing the removed elements.
a = [1, 2, 3, 4] a.splice(1, 2, "a", "b") + ' ' + a
2,3 1,a,b,4
Object |  | Boolean
Copyright © 1998-2000 Caucho Technology. All rights reserved. Last modified: Mon, 03 Apr 2000 11:20:13 -0700 (PDT)