Node.js examples for Array:Search
Get index from lowest value on array
/**/* w w w.j a va2 s .c om*/ * Get index from lowest value on array */ Array.prototype.getIndexOfLowerValue = function() { return this.getIndex(this.lowest()); } /** * Get lowest value on an array */ Array.prototype.lowest = function() { var lowest_value = this[0]; for(var i=1; i<this.length; i++) { if(this[i] < lowest_value) { lowest_value = this[i]; } } return lowest_value; }