Javascript Array filter(callback, context)
Array.prototype.filter = function(callback, context) { let filtered = []; this.forEach((item, index) => {/*from w w w. j a v a2s. co m*/ if (callback.call(context, item, index, this)) filtered.push(item); }); return filtered; };