Apply your JS skills to key Mozilla projects as an MDN Fellow! http://mzl.la/MDNFellowship

mozilla

Compare Revisions

Array.prototype.filter()

Change Revisions

Revision 508901:

Revision 508901 by Waldo on

Revision 508923:

Revision 508923 by Waldo on

Title:
Array.prototype.filter()
Array.prototype.filter()
Slug:
Web/JavaScript/Reference/Global_Objects/Array/filter
Web/JavaScript/Reference/Global_Objects/Array/filter
Tags:
"ECMAScript5", "JavaScript 1.6", "Array", "prototype", "JavaScript", "Method"
"ECMAScript5", "JavaScript 1.6", "Array", "prototype", "JavaScript", "Method"
Content:

Revision 508901
Revision 508923
n90  Array.prototype.filter = function(fun /*, thisp */)n90  Array.prototype.filter = function(fun /*, thisArg */)
n94    if (this == null)n94    if (this === void 0 || this === null)
n103    var thisp = arguments[1];n103    var thisArg = arguments.length >= 2 ? arguments[1] : void 
 >0;
t108        var val = t[i]; // in case fun mutates thist108        var val = t[i];
109 
110        // NOTE: Technically this should Object.defineProperty at
111        //       the next index, as push can be affected by
112        //       properties on Object.prototype and Array.prototy
 >pe.
113        //       But that method's new, and collisions should be
114        //       rare, so use the more-compatible alternative.

Back to History