get

get ( array/map/list arrayOrMap , object indexLevel1 , object indexLevel2 , object ... ) : object

Return an element in a list of elements using multiple level of index.

Example

tab=[
"Hello" : [
"James" : "in car",
"Henry" : "in plane"
],
"Bye" : "Jack"
]

console( get(tab, "Bye") ) // -> "Jack"
console( get(tab, "Hello") ) // -> {James=in car, Henry=in plane}
console( get(get(tab, "Hello"),"Henry") ) // -> "in plane"
console( get(tab, "Hello", "James") ) // -> "in car"

Parameters

arrayOrMap

Your list of element. Can be an array, a map, a list, etc. If it is another or it is null, the function does not make any error but returns null.

indexLevel1

The index of your element. You can use negative values to go in the opposite direction. For example, -1 return the last element and -2 the penultimate. In an array the first element an the 0-nth, not the 1! If index is null returns null.

indexLevel2

The index of your element on a deeper level

...

Deeper levels of index