-
Notifications
You must be signed in to change notification settings - Fork 3
Yasser Moradi edited this page Sep 1, 2015
·
1 revision
Description:
This method returns the Largest values in a sequence. The default overload which has no arguments can be used for numeric sequence. It accepts an argument as selector that the selected property should be numeric
Samples:
let numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 15, 19];
let stock = [
{ name: 'Apple', category: 'Fruit', price: 0.30 },
{ name: 'Banana', category: 'Fruit', price: 0.35 },
{ name: 'Orange', category: 'Fruit', price: 0.29 },
{ name: 'Cabbage', category: 'Vegetable', price: 0.49 },
{ name: 'Carrot', category: 'Vegetable', price: 0.29 },
{ name: 'Lettuce', category: 'Vegetable', price: 0.30 },
{ name: 'Milk', category: 'Dairy', price: 1.12 }
];
let max = numbers.asEnumerable().max();
console.log('Smallest value in numbers collection => ' + max);
max = stock.asEnumerable().max(item => item.price);
console.log('Largest price in stockitems => ' + max);