Javascript Array getIndexBy(name, value)
Array.prototype.getIndexBy = function (name, value) { for (var i = 0; i < this.length; i++) { if (this[i][name] == value) { return i; }/*from www . j a v a 2 s.co m*/ } return -1; }
'use strict';/*from w ww . ja va 2 s .c o m*/ Array.prototype.getIndexBy = function (name, value) { for (var i = 0; i < this.length; i++) { if (this[i][name] === value) { return i; } } };