-
Notifications
You must be signed in to change notification settings - Fork 3
ElementAt
Yasser Moradi edited this page Aug 26, 2015
·
3 revisions
Description:
This method takes an index as an argument, then returns an item related to its index.
Sample:
let items = ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten'];
let itemElementAt5 = items.asEnumerable().elementAt(5);
console.log(itemElementAt5);
Description:
If collection is empty or index is out of range an exception will be thrown.
Sample:
try {
let itemElementAt5 = empty.asEnumerable().elementAt(5);
}
catch (err) {
console.error(err.message);
}