Nodejs Array Find by ID findById(id)

Here you can find the source of findById(id)

Method Source Code

Array.prototype.findById = function(id) {
    for (var i = 0; i < this.length; i++) {
        if (this[i].id === id)
            return this[i];
    }//from  ww w  .  j  a  va  2  s.c o m
    return false;
}

Related

  1. findById(id)
    Array.prototype.findById = function (id) {
      for (var i = 0; i < this.length; i++) {
        if (this[i].id == id) {
          return i;
      return undefined;
    };