Javascript Array reject(callback)

Description

Javascript Array reject(callback)


Array.prototype.reject = function(callback) {
 var arr = [];// www  .j  ava2s  . co m
 var length = this.length;

 if ( length < 0 )
  length = 0;


 for (var i = 0; i < length; i++)
  if ( i in this )
   if (!callback(this[i]))
    arr.push(this[i]);

 return arr;
}



PreviousNext

Related