arrayLast

Returns the last item from an array. Throws an error if the array is empty.

arrayLast(array) → returns any

Member Function Syntax

array.last()

arrayLast Argument Reference

array array
Required

Examples sample code invoking the arrayLast function

Uses the arrayLast function to retrieve the last element of an array

someArray = [1,2,3];
lastOne=arrayLast(someArray);
writeOutput(lastOne);

Expected Result: 3


Fork me on GitHub