This project is read-only.

at(index)

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.

Examples

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

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

document.writeln("The name chosen at random is '" + name + "'.");

/*
This code produces the following sample output:

The name chosen at random is 'Ito, Shu'.
*/

Last edited May 15, 2012 at 12:51 PM by suckgamoni, version 1

Comments

No comments yet.