Nodejs Array Without without(ar)

Here you can find the source of without(ar)

Method Source Code

Array.prototype.without = function(ar) {
   var results = [];
   for (var i = 0, len = this.length; i < len; i++) {
      var found = false;
      for (var j = 0, len2 = ar.length; j < len2; j++) {
         if (this[i] === ar[j]) {
            found = true;// w  w  w  .java  2 s.co m
            break;
         }
      }
      if (!found) {
         results.push(this[i]);
      }
   }
   
   return results;
};

Related

  1. without()
    Array.prototype.without = function() {
      var args = $A(arguments);
      return this.select(function(value) {
        return !args.include(value);
      });
    };
    
  2. without(ar)
    Array.prototype.without = function(ar) {
      var results = [];
      for (var i = 0, len = this.length; i < len; i++) {
        if (ar.indexOf(this[i]) < 0) {
          results.push(this[i]);
      return results;
    };
    ...
    
  3. without(index)
    Array.prototype.without = function(index){
      var part1 = index > 0 ? this.slice(0,index) : []
      var part2 = this.slice(index+1)
      return part1.concat(part2);
    };
    
  4. without(key, value)
    Array.prototype.without = function (key, value) {
        return this.filter(function (e) {
            return e[key] != value;
        });
    
  5. without(other)
    Array.prototype.without = function(other) {
      var result = [];
      for(var i = 0; i < this.length; i++)
        if(!other.has(this[i]))
          result.push(this[i]);
      return result;
    };