min([selector, arg])

suckgamoni edited this page May 15, 2013 · 1 revision

Returns the value which its selected value is the minimum.

Syntax

Parameters

selector

Type: function(value, key, arg)
A selector function to each element.

arg

An external argument.

Return Value

The minimum value in the sequence.


Example

var longs = [ 4294967296, 466855135, 81125 ];
var min = from(longs).min();

console.log("The largest number is " + min);

/*
 This code produces the following output:

 The largest number is 81125
*/
var pets = [ { name: "Barley", age: 8 },
             { name: "Boots", age: 5 },
             { name: "Whiskers", age: 1 } ];

var minPet = from(pets).min("$age + $name.length");

console.log("The pet whose age plus name length is minimum is " + minPet.name);

/*
 This code produces the following output:

 The pet whose age plus name length is minimum is Whiskers
*/