Nodejs Array Has Object hasObject(

Here you can find the source of hasObject(

Method Source Code

Array.prototype.hasObject = (
  !Array.indexOf ? function (o)
  {//from  w  ww .j  a  va 2s.c  o m
    var l = this.length + 1;
    while (l -= 1)
    {
        if (this[l - 1] === o)
        {
            return true;
        }
    }
    return false;
  } : function (o)
  {
    return (this.indexOf(o) !== -1);
  }
);

Related

  1. hasObject(o)
    Array.prototype.hasObject = function (o)
        var l = this.length + 1;
        while (l -= 1)
            if (this[l - 1].name === o.name)
                return true;
        return false;
    
  2. hasObject(o)
    Array.prototype.hasObject = (!Array.indexOf ? function (o) {
      var l = this.length + 1;
      while (l--) {
        if (this[l - 1] === o) {
          return true;
      return false;
    } : function (o) {
    ...
    
  3. hasObjectExists(item)
    Array.prototype.hasObjectExists = function(item) {
        for (i = 0; i < this.length; i++) {
            if(this[i].id == item.id){
                return true;
        return false;
    };