Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

take(count)

suckgamoni edited this page · 1 revision

Returns a specified number of contiguous elements from the start of a sequence.

Syntax

Parameters

count

Type: number
The number of elements to return.

Return Value

An iterable object that contains the specified number of elements from the start of the input sequence.


Example

var grades = [ 59, 82, 70, 56, 92, 98, 85 ];

var topThreeGrades = from(grades).orderByDesc().take(3);

console.log("The top three grades are:");
topThreeGrades.each("console.log($)");
/*
 This code produces the following output:

 The top three grades are:
 98
 92
 85
*/
Something went wrong with that request. Please try again.