Last updated 20 days ago
Was this helpful?
Return first item in array
Uses the arrayLast function to retrieve the last element of an array
Result: "third"
names = [ "Marcus", "Sarah", "Josefine" ]; dump( names.last() ); // outputs 'Josefine'
names = array( "Marcus", "Sarah", "Josefine" ); dump( arrayLast( names ) ); // outputs 'Josefine'
ArrayLast(array=[array])
array
true
The array to get the last
someArray = [ "first", "second", "third" ]; lastOne = arrayLast( someArray ); writeOutput( lastOne );