min :: Enumerable

min([iterator = Prototype.K]) -> minValue Returns the minimum element (or element-based computation), or undefined if the enumeration is empty. Elements are either compared directly, or by first applying the iterator and comparing returned values.

Note: for equivalent elements, the earliest one is returned.

Examples

$R(1,10).min()

// -> 1

['hello', 'world', 'gizmo'].min()

// -> 'gizmo'

function Person(name, age) {

this.name = name;

this.age = age;

}

var john = new Person('John', 20);

var mark = new Person('Mark', 35);

var daisy = new Person('Daisy', 22);

[john, mark, daisy].min(function(person) {

return person.age;

})

// -> 20

Prototype API 1.5.0 - prototypejs.org