Argmin and argmax

Math.argmin = function(values) {return values.indexOf(this.min.apply(this, values));} Math.argmax = function(values) {return values.indexOf(this.max.apply(this, values));} console.log(Math.argmin([12,16,18,19,10,23,13,15])) // 4 console.log(Math.argmax([12,16,18,19,10,23,13,15])) // 5