Javascript Array reject(fun)

Description

Javascript Array reject(fun)

Array.prototype.reject = function(fun) {
  return this.reduce(function(res, el) {
    if(!fun(el)) {
      res.push(el);// w  w w.ja  v a  2 s.co m
    };
    return res;
  }, []);
}



PreviousNext

Related