PICK_ITEM

Pick item from a list by its index

Description

Returns an item in the source list by the given index. If Index is out of bounds for the list (i.e. negative or larger than the list length - 1, since indexing starts from 0), null is returned.

Function signature

PICK_ITEM(values: Array, index: ) => Number|Undefined|String|Array|Object|Boolean

Parameter

Description

Values

Source list

Index

Index of item to return

Examples

numbers = [1,2,3]
complexArray = [1,0,2,"test",null,null,[1,2,3],{"a":10},[],{},false,true]

Formula

Return value

PICK_ITEM(numbers, 0)

1

PICK_ITEM(numbers, 1)

2

PICK_ITEM(numbers, 10)

undefined

PICK_ITEM(numbers, -10)

undefined

PICK_ITEM(complexArray, 0)

1

PICK_ITEM(complexArray, 3)

test

PICK_ITEM(complexArray, 4)

null

PICK_ITEM(complexArray, 5)

undefined

PICK_ITEM(complexArray, 6)

[1,2,3]

PICK_ITEM(complexArray, 7)

{"a":10}

PICK_ITEM(complexArray, 10)

false