-
Notifications
You must be signed in to change notification settings - Fork 0
Array
-
First element in an array
[1,2,3,3,4,5,6,7,8,8,9,6,5,4].first()
result
1
-
Last element in an array
[1,2,3,3,4,5,6,7,8,8,9,6,5,4].last()
result
4
-
check if an array contain an element
["A","B","C","D","E","F"].containElement("A")
result
true
-
Eliminate all element duplicated in an array
[1,2,3,3,4,5,6,7,8,8,9,6,5,4].even()
result
[1,2,3,4,5,6,7,8,9]
-
Remove elements in an array
-
example 1
[1,2,3,3].remove(3)
result
[1,2]
-
example 2
["A","B","C","D","E","F"].remove(["A","B","C"])
result
["D","E","F"]
-
-
generate an array of specific element
-
example 1
var myarray = Array().generateScale('letters','upper','a','c',null)
result
["A","B","C"]
-
example 2
var myarray = Array().generateScale('letters','lower','a','f',2)
result
["a","c","e"]
-
example 3
var myarray = Array().generateScale('numbers',null,0,9,3)
result
[0,3,6,9]
-
example 4
var myarray = Array().generateScale('numbers',null,-9,0,1)
result
[-9,-8,-7,-6,-5,-4,-3,-2,-1,0]
-
-
Take all even numbers in an array
[1,2,3,3,4,5,6,7,8,8,9,6,5,4].even()
result
[2,4,6,8,8,6,4]
-
Take all even index in an array
["a","A","b","B","c","C","d","D","e","E","f","F"].evenIndex()
result
["a","b","c","d","e","f"]
-
Take all odd numbers in an array
[1,2,3,3,4,5,6,7,8,8,9,6,5,4].odd()
result
[1,3,3,5,7,9,5]
-
Take all odd index in an array
["a","A","b","B","c","C","d","D","e","E","f","F"].oddIndex()
result
["A","B","C","D","E","F"]