Nodejs Utililty Methods Array Find by ID

List of utility methods to do Array Find by ID

Description

The list of methods to do Array Find by ID are organized into topic(s).

Method

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