ArrayFirst

Return first item in array

Method Signature

ArrayFirst(array=[array])

Arguments

Argument
Type
Required
Description
Default

array

array

true

The array to get the first item from.

Examples

Member Function

Use the member function to return the first item from an array

Run Example

someArray = [ 
	1,
	2,
	3,
	4
];
WriteOutput( someArray.first() );

Result: 1

Non-Member Function

Return the first item from an array

Run Example

seinfeldArray = [ 
	"Jerry",
	"Elaine",
	"Kramer",
	"George"
];
WriteOutput( arrayFirst( seinfeldArray ) );

Result: "Jerry"

Additional Examples

aNames = array( "Marcus", "Sarah", "Josefine" );
dump( var=aNames, label="aNames - original array" );
dump( var=arrayFirst( aNames ), label="first element of array aNames" );

Last updated

Was this helpful?