Javascript Array collect(fun)

Description

Javascript Array collect(fun)

Array.prototype.collect = function(fun) {
    var result = [];
    this.each(function(it) {
        result.push(fun(it));//from   w  ww.  ja  v  a2  s  . co m
    });
    return result;
};



PreviousNext

Related