Interface

Array

Array

Progressbar timer

View Source js/globals.d.ts, line 13

Members

Array.<T>

# add

Add Element

View Source js/globals.d.ts, line 30

Example
var a = [1,2];
a.add(3);
console.log(a); // [1,2,3]

var b = [0,9];
console.log(b.add(2)); // [0,9,2]
Array.<T>

# addAll

Add other array

View Source js/globals.d.ts, line 43

Example
var a = [0,1];
var b = ['a','b'];
console.log(b.addAll(a)); //['a','b',0,1]
var c = ['z',10];
c.add(b);
console.log(c); // ['z',10,'a','b',0,1]
Array.<T>

# compact

Removes null and undefined elements from the array, turning it into a dense array. Returns self for chaining purposes

View Source js/globals.d.ts, line 114

boolean

# contains

Check array contains string/any

View Source js/globals.d.ts, line 128

Example
alert([1, 2, 3].contains(2)); // => true
alert([1, 2, 3].contains('2')); // => false
Array.<T>

# deleteAt

Deletes the element at the specified index, returning that element, or undefined if the index is out of range. A negative index is counted from the end of the array, where -1 corresponds to the last element. Returns self for chaining purposes.

View Source js/globals.d.ts, line 102

Example
var a = ["ant", "bat", "cat", "dog"]
  a.deleteAt(2)    // => "cat"
  a                // => ["ant", "bat", "dog"]
  a.deleteAt(99)   // => undefined
boolean

# exists

Check element index exists

View Source js/globals.d.ts, line 120

Example
['a','b'].exists(1); //true
['a','b'].exists(4); //false
Array.<T>

# first

Returns the first element, or the first n elements, of the array. If the array is empty, requesting one element returns undefined , and requesting multiple elements returns an empty array.

View Source js/globals.d.ts, line 71

Example
var a = [ "q", "r", "s", "t" ]
  a.first()   // => "q"
  a.first(2)  // => ["q", "r"]
boolean

# isEmpty

Returns true if self contains no elements.

View Source js/globals.d.ts, line 66

Array.<T>

# last

Returns the last element(s) of self. If the array is empty, returns undefined if only one element requested.

View Source js/globals.d.ts, line 82

Example
var a = [ "w", "x", "y", "z" ]
  a.last()     // => "z"
  a.last(2)    // => ["y", "z"]
function

# random

Pick random array element

View Source js/globals.d.ts, line 25

Array.<T>

# range

Get element in range from array

View Source js/globals.d.ts, line 56

Example
const arr = [1, 2, 3, 4, 5];
console.log(arr.range(1, 3));
Array.<T>

# shuffle

Randomize array elements

View Source js/globals.d.ts, line 137

Example
alert([1,2,3,4,5].shuffle())
function

# unique

Array unique

View Source js/globals.d.ts, line 17

Example
var duplicate = [1,2,1,2,3,4,5,6];
var unique = duplicate.unique(); // [1,2,3,4,5,6]
void

# unset

Unset element value from array

View Source js/globals.d.ts, line 92

Example
var arr = ['a','b','c'];
arr.unset('c');
console.log(arr); // ['a','b']