Child pages
  • Array

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Hidden
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY, UNLESS YOU KNOW WHAT YOU'RE DOING.
		THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO EXTRACT CHANGES FROM THE PAGE AND MERGE THEM BACK INTO SERVOY SOURCE


HTML Table
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Property Summary
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#length
Get the length of the array.

HTML Table
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Array
Table Cell (td)
#concat(value1, [value2], [valueN])
Returns a new array comprised of this array joined with other array(s) and/or value(s).
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#every(callback, [thisObject])
Runs a function on items in the array while that function is returning true.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Array
Table Cell (td)
#filter(callback, [thisObject])
Runs a function on every item in the array and returns an array of all items for which the function returns true.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#forEach(callback, [thisObject])
Runs a function on every item in the array.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#indexOf(searchElement, [fromIndex])
Returns the first index at which a given element can be found in the array, or -1 if it is not present.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#join(delimiter)
Puts all elements in the array into a string, separating each element with the specified delimiter
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#lastIndexOf(searchElement, [fromIndex])
Returns the last index at which a given element can be found in the array, or -1 if it is not present.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Array
Table Cell (td)
#map(callback, [thisObject])
Runs a function on every item in the array and returns the results in an array.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Object
Table Cell (td)
#pop()
Pops the last string off the array and returns it.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#push(value1, [value2], [valueN])
Mutates an array by appending the given elements and returning the new length of the array.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Array
Table Cell (td)
#reverse()
Puts array elements in reverse order.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Object
Table Cell (td)
#shift()
Decreases array element size by one by shifting the first element off the array and returning it.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Array
Table Cell (td)
#slice(begin, [end])
The slice method creates a new array from a selected section of an array.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#some(callback, [thisObject])
Runs a function on items in the array while that function returns false.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Array
Table Cell (td)
#sort([function])
Sorts the array elements in dictionary order or using a compare function passed to the method.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Array
Table Cell (td)
#splice(arrayIndex, length, [value1], [value2], [valueN])
It is used to take elements out of an array and replace them with those specified.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Array
Table Cell (td)
#unshift(value1, value2, valueN)
Places element data at the start of an array.

HTML Table
idproperty
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Property Details
Table Body (tbody)
idlength
classnode
Table Row (tr)
idname
Table Cell (td)
length
Table Row (tr)
iddes
Table Cell (td)
Get the length of the array.
Table Row (tr)
idret
Table Cell (td)
Returns
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
array.length
Table Row (tr)
classlastDetailRow
Table Cell (td)


HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Method Details
Table Body (tbody)
idconcat
classnode
Table Row (tr)
idname
Table Cell (td)
concat
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Array
Span
stylefloat: left; font-weight: bold;
idiets
concat
Span
stylefloat: left;
idiets
(value1, [value2], [valueN])
Table Row (tr)
iddes
Table Cell (td)
Returns a new array comprised of this array joined with other array(s) and/or value(s).
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} value1
{Object} [value2]
{Object} [valueN]
Table Row (tr)
idret
Table Cell (td)
Returns
Array
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
array.concat();
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idevery
classnode
Table Row (tr)
idname
Table Cell (td)
every
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
every
Span
stylefloat: left;
idiets
(callback, [thisObject])
Table Row (tr)
iddes
Table Cell (td)
Runs a function on items in the array while that function is returning true. It returns true if the function returns true for every item it could visit.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Function} callback
{Array} [thisObject]
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
function isNumber(value) { return typeof value == 'number'; }
var a1 = [1, 2, 3];
application.output(a1.every(isNumber));
var a2 = [1, '2', 3]; 
application.output(a2.every(isNumber));
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idfilter
classnode
Table Row (tr)
idname
Table Cell (td)
filter
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Array
Span
stylefloat: left; font-weight: bold;
idiets
filter
Span
stylefloat: left;
idiets
(callback, [thisObject])
Table Row (tr)
iddes
Table Cell (td)
Runs a function on every item in the array and returns an array of all items for which the function returns true.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Function} callback
{Array} [thisObject]
Table Row (tr)
idret
Table Cell (td)
Returns
Array
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var a1 = ['a', 10, 'b', 20, 'c', 30];
var a2 = a1.filter(function(item) { return typeof item == 'number'; });
application.output(a2);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idforEach
classnode
Table Row (tr)
idname
Table Cell (td)
forEach
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
void
Span
stylefloat: left; font-weight: bold;
idiets
forEach
Span
stylefloat: left;
idiets
(callback, [thisObject])
Table Row (tr)
iddes
Table Cell (td)
Runs a function on every item in the array.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Function} callback
{Array} [thisObject]
Table Row (tr)
idret
Table Cell (td)
Returns
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
function printThemOut(params) {	application.output(params);} 
var a = ['a', 'b', 'c'];	
a.forEach(printThemOut);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idindexOf
classnode
Table Row (tr)
idname
Table Cell (td)
indexOf
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Number
Span
stylefloat: left; font-weight: bold;
idiets
indexOf
Span
stylefloat: left;
idiets
(searchElement, [fromIndex])
Table Row (tr)
iddes
Table Cell (td)
Returns the first index at which a given element can be found in the array, or -1 if it is not present.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} searchElement
{Number} [fromIndex]
Table Row (tr)
idret
Table Cell (td)
Returns
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var a = ['a', 'b', 'a', 'b', 'a'];
application.output(a.indexOf('b'));
application.output(a.indexOf('b', 2));
application.output(a.indexOf('z'));
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idjoin
classnode
Table Row (tr)
idname
Table Cell (td)
join
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
join
Span
stylefloat: left;
idiets
(delimiter)
Table Row (tr)
iddes
Table Cell (td)
Puts all elements in the array into a string, separating each element with the specified delimiter
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} delimiter
Table Row (tr)
idret
Table Cell (td)
Returns
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var words = new Array("limit","lines","finish","complete","In","Out");
var jwords = words.join(";");
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idlastIndexOf
classnode
Table Row (tr)
idname
Table Cell (td)
lastIndexOf
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Number
Span
stylefloat: left; font-weight: bold;
idiets
lastIndexOf
Span
stylefloat: left;
idiets
(searchElement, [fromIndex])
Table Row (tr)
iddes
Table Cell (td)
Returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards, starting at fromIndex.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} searchElement
{Number} [fromIndex]
Table Row (tr)
idret
Table Cell (td)
Returns
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var a = ['a', 'b', 'c', 'd', 'a', 'b'];
application.output(a.lastIndexOf('b'));
application.output(a.lastIndexOf('b', 4));
application.output(a.lastIndexOf('z'));
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idmap
classnode
Table Row (tr)
idname
Table Cell (td)
map
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Array
Span
stylefloat: left; font-weight: bold;
idiets
map
Span
stylefloat: left;
idiets
(callback, [thisObject])
Table Row (tr)
iddes
Table Cell (td)
Runs a function on every item in the array and returns the results in an array.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} callback
{Array} [thisObject]
Table Row (tr)
idret
Table Cell (td)
Returns
Array
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var a = ['a', 'b', 'c'];	
var a2 = a.map(function(item) { return item.toUpperCase(); });	
application.output(a2);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idpop
classnode
Table Row (tr)
idname
Table Cell (td)
pop
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Object
Span
stylefloat: left; font-weight: bold;
idiets
pop
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Pops the last string off the array and returns it.
Table Row (tr)
idret
Table Cell (td)
Returns
Object
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var words = new Array("limit","lines","finish","complete","In","Out");
var lastword = words.pop();
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idpush
classnode
Table Row (tr)
idname
Table Cell (td)
push
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Number
Span
stylefloat: left; font-weight: bold;
idiets
push
Span
stylefloat: left;
idiets
(value1, [value2], [valueN])
Table Row (tr)
iddes
Table Cell (td)
Mutates an array by appending the given elements and returning the new length of the array.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} value1
{Object} [value2]
{Object} [valueN]
Table Row (tr)
idret
Table Cell (td)
Returns
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var words = new Array("limit","lines","finish","complete");
words.push("In","Out");
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idreverse
classnode
Table Row (tr)
idname
Table Cell (td)
reverse
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Array
Span
stylefloat: left; font-weight: bold;
idiets
reverse
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Puts array elements in reverse order.
Table Row (tr)
idret
Table Cell (td)
Returns
Array
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var words = new Array("limit","lines","finish","complete","In","Out");
words.reverse();
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idshift
classnode
Table Row (tr)
idname
Table Cell (td)
shift
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Object
Span
stylefloat: left; font-weight: bold;
idiets
shift
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Decreases array element size by one by shifting the first element off the array and returning it.
Table Row (tr)
idret
Table Cell (td)
Returns
Object
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var words = new Array("limit","lines","finish","complete","In","Out");
words.shift();
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idslice
classnode
Table Row (tr)
idname
Table Cell (td)
slice
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Array
Span
stylefloat: left; font-weight: bold;
idiets
slice
Span
stylefloat: left;
idiets
(begin, [end])
Table Row (tr)
iddes
Table Cell (td)
The slice method creates a new array from a selected section of an array.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} begin
{Object} [end]
Table Row (tr)
idret
Table Cell (td)
Returns
Array
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var words = new Array("limit","lines","finish","complete","In","Out");
var nwords1 = words.slice(3, 5);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsome
classnode
Table Row (tr)
idname
Table Cell (td)
some
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
some
Span
stylefloat: left;
idiets
(callback, [thisObject])
Table Row (tr)
iddes
Table Cell (td)
Runs a function on items in the array while that function returns false. It returns true if the function returns true for any item it could visit.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Function} callback
{Array} [thisObject]
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
function isNumber(value) { return typeof value == 'number'; }  
var a1 = [1, 2, 3];    
application.output(a1.some(isNumber)); 
var a2 = [1, '2', 3];  
application.output(a2.some(isNumber));
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsort
classnode
Table Row (tr)
idname
Table Cell (td)
sort
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Array
Span
stylefloat: left; font-weight: bold;
idiets
sort
Span
stylefloat: left;
idiets
([function])
Table Row (tr)
iddes
Table Cell (td)
Sorts the array elements in dictionary order or using a compare function passed to the method.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Function} [function]
Table Row (tr)
idret
Table Cell (td)
Returns
Array
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var words = new Array("limit","lines","finish","complete","In","Out");
words.sort();
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsplice
classnode
Table Row (tr)
idname
Table Cell (td)
splice
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Array
Span
stylefloat: left; font-weight: bold;
idiets
splice
Span
stylefloat: left;
idiets
(arrayIndex, length, [value1], [value2], [valueN])
Table Row (tr)
iddes
Table Cell (td)
It is used to take elements out of an array and replace them with those specified.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} arrayIndex
{Object} length
{Object} [value1]
{Object} [value2]
{Object} [valueN]
Table Row (tr)
idret
Table Cell (td)
Returns
Array
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var words = new Array("limit","lines","finish","complete","In","Out");
var nwords1 = words.splice(3, 2, "done", "On");
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idunshift
classnode
Table Row (tr)
idname
Table Cell (td)
unshift
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Array
Span
stylefloat: left; font-weight: bold;
idiets
unshift
Span
stylefloat: left;
idiets
(value1, value2, valueN)
Table Row (tr)
iddes
Table Cell (td)
Places element data at the start of an array.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} value1
{Object} value2
{Object} valueN
Table Row (tr)
idret
Table Cell (td)
Returns
Array
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var words = new Array("finish","complete","In","Out");
words.unshift("limit","lines");
Table Row (tr)
classlastDetailRow
Table Cell (td)