Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

at(index)

suckgamoni edited this page · 1 revision

Returns the element at a specified index in a sequence.

Syntax

Parameters

index

Type: number
The zero-based index of the element to retrieve.

Return Value

The element at the specified position in the source sequence.


Example

var names = [ "Hartono, Tommy", "Adams, Terry", "Andersen, Henriette Thaulow",  "Hedlund, Magnus", "Ito, Shu" ];

var name = from(names).at(parseInt(Math.random() * names.length));

console.log("The name chosen at random is '" + name + "'.");

/*
This code produces the following sample output:

The name chosen at random is 'Ito, Shu'.
*/
Something went wrong with that request. Please try again.