function mnm( args, end ) {
var pool = Array.prototype.splice.call(args, 0),
pos = end ? pool.length-1 : 0;
return pool.sort(function(a, b) {
return a - b;
})[pos];
}
function min() {
return mnm(arguments, false);
}
function max() {
return mnm(arguments, true);
}
console.log(
min(10,20,100,500,5,225),
max(10,20,100,500,5,225)
);