Javascript Array findByName(name)
/**/*from w ww .j a v a 2 s .c o m*/ * Array Utilities */ Array.prototype.findByName = function(name) { name = String(name); return this.find(i => i.name === name); };
/**//from ww w . j a v a 2 s. c o m * Array Utilities */ Array.prototype.findByName = function(name) { for(var i = 0; i< this.length; ++i) { if( this[i].name == name) { return this[i]; } } };