Nodejs Array Contain Object containsObject(obj)

Here you can find the source of containsObject(obj)

Method Source Code

Array.prototype.containsObject = function (obj) {
    var contains = false;
    for (var i = 0; i < this.length; i++) {
        if (this[i] == obj) {
            contains = true;/*from  w w w.  ja  v a  2s  .c om*/
        }
    }
    return contains;
};

Related

  1. containsObject(obj)
    Array.prototype.containsObject = function(obj){
        var i;
        for (i = 0; i < this.length; i++) {
            if (this[i] === obj) {
                return true;
        return false;
    };
    ...
    
  2. containsObject(obj)
    Array.prototype.containsObject=function(obj){
      var haveObj=false;
      for(var i=0;i<this.length;i++){
        if(this[i]==obj){
          haveObj=true;
          break;
      return haveObj;
    ...
    
  3. containsObjectById(id)
    Array.prototype.containsObjectById = function (id) {
        for (var i = 0; i < this.length; i++) {
            if (this[i].id === id) {
                return true;
        return false;
    };