18.8.2.12 Math.min([value1[, value2[, ... ]]])

2010-07-12

number Math.min([value1number|mixed[, value2:number|mixed[, ... ]]])

Returns the lowest number of all given arguments (all coerced to number). Any NaN causes a return of NaN. Uses RelationalComparison (11.8.5), except that +0 is greater than -0.

Code: (Meta Ecma)
Math.min= function(){
if (arguments.length == 0) return +Infinity;
var arr = [];
for (var i=0, n=arguments.length; i var smallestV = arr[0];
for (i=1; i if (isNaN(arr[i ])) return NaN;
if (RelationalComparison(arr[i ],smallestV,true) || (arr[i ] === -0 && smallestV === +0)) smallestV = arr[i ];
}
return smallestV;
}