Nodejs Array Remove Min removeMin()

Here you can find the source of removeMin()

Method Source Code

var a = [2,12,34,4];

Array.prototype.removeMin = function(){
var min1 = Math.min.apply(null,this);
var pos = this.indexOf(min1);
return this.splice(pos,1);
}


a.removeMin();// w  ww . j a v a 2 s  . co m