-
Notifications
You must be signed in to change notification settings - Fork 3
Take
Yasser Moradi edited this page Aug 23, 2015
·
1 revision
Description:
Take returns a number from the beginning of the source collection.The number is specified as the only parameter to the method.In the sample code below, the first five elements of the array of fruit names are extracted.
Samples:
let fruits = ['Apple', 'Banana', 'Cherry', 'Damson', 'Elderberry', 'Grape', 'Kiwi', 'Lemon', 'Melon', 'Orange'];
let takePartitioned = fruits.asEnumerable().take(5).toArray();
console.log('*** Extracting the first five elements of the array by take method ...');
for (let index = 0; index < takePartitioned.length; index++)
console.log(takePartitioned[index]);