Returns the first N items from an array or string

Parameters

array Array (required) - an array object

count Number (optional) [default = 1] - The number of items to return

Returns

Object

Examples

FIRST([1, 2, 3])

// returns 1
FIRST(['a', 'b', 'c'], 2)

// returns ["a","b"]
FIRST('abc')

// returns "a"
FIRST('abc', 2)

// returns ["a","b"]

Did this page help you?