Progressbar timer
Members
# add
Add Element
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]
# addAll
Add other array
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]
# compact
Removes null and undefined elements from the array, turning it into a dense array. Returns self for chaining purposes
# contains
Check array contains string/any
Example
alert([1, 2, 3].contains(2)); // => true
alert([1, 2, 3].contains('2')); // => false
# 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.
Example
var a = ["ant", "bat", "cat", "dog"]
a.deleteAt(2) // => "cat"
a // => ["ant", "bat", "dog"]
a.deleteAt(99) // => undefined
# exists
Check element index exists
Example
['a','b'].exists(1); //true
['a','b'].exists(4); //false
# 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.
Example
var a = [ "q", "r", "s", "t" ]
a.first() // => "q"
a.first(2) // => ["q", "r"]
# last
Returns the last element(s) of self. If the array is empty, returns undefined if only one element requested.
Example
var a = [ "w", "x", "y", "z" ]
a.last() // => "z"
a.last(2) // => ["y", "z"]
# range
Get element in range from array
Example
const arr = [1, 2, 3, 4, 5];
console.log(arr.range(1, 3));
# unique
Array unique
Example
var duplicate = [1,2,1,2,3,4,5,6];
var unique = duplicate.unique(); // [1,2,3,4,5,6]
# unset
Unset element value from array
Example
var arr = ['a','b','c'];
arr.unset('c');
console.log(arr); // ['a','b']