Here you can find the source of where(inclusionTest)
Array.prototype.where = function (inclusionTest) { var results = []; for (var i = 0; i < this.length; i++) { if (inclusionTest(this[i])) results.push(this[i]);/*from w w w.j a v a 2 s . c om*/ } return results; }; Array.prototype.select = function (projection) { var results = []; for (var i = 0; i < this.length; i++) { results.push(projection(this[i])); } return results; }; const children = [{ id: 1, Name: "Rob" }, { id: 2, Name: "Sansa" }, { id: 3, Name: "Arya" }, { id: 4, Name: "Brandon" }, { id: 5, Name: "Rickon" }]; var filteredChildren = children.where(function (x) { return x.id % 2 == 0; }).select(function (x) { return x.Name; }); console.dir(children); console.dir(filteredChildren);
Array.prototype.where = function(f){ var fn = f; if(typeof f == 'string'){ if((fn=lambda(fn)) == null){ throw "Syntax error in lambda string: "+ f; };
Array.prototype.where = function(f){ var newArray = []; for(var i = 0; i < this.length; i++){ if(f(this[i])){ newArray.push(this[i]); return newArray; }; ...
Array.prototype.where = function(func) { var result = []; for (var i = 0; i < this.length; i++) if (func(this[i])) result.push(this[i]); return result; };
Array.prototype.where = function(func){ var result = []; forEach(this, function (element) { if(func(element)){ result.push(element); }); return result;
Array.prototype.where = function (func) { var items = [], length = this.length; for (var i = 0; i < length; i++) { if (func(this[i])) items.push(this[i]); return items.length === 0 ? null : items;
Array.prototype.where = function (inclusionTest) { var results = []; for (var i = 0; i < this.length; i++) { if (inclusionTest(this[i])) results.push(this[i]); return results; };
Array.prototype.where = function(predicate) { var derivedArray = []; for (i = 0; i < this.length; i += 1) { if (predicate(this[i])) { derivedArray.push(this[i]); return derivedArray;
Array.prototype.where = function (predicate) { if (predicate == null || typeof (predicate) !== 'function') throw new Error('predicate should'); var result = []; for (var i = 0; i < this.length; i++) { if (predicate(this[i], i)) result.push(this[i]); return result; };
Array.prototype.where = function (predicate) { var ret = []; for (var i = 0; i < this.length; ++i) { if (predicate(this[i], i)) ret.push(this[i]); return ret; };