Javascript Array filter(callback, scope)
// Array.prototype.filter Array.prototype.filter = function filter(callback, scope) { for (var array = this, arrayB = [], index = 0, length = array.length, element; index < length; ++index) { element = array[index];/*from ww w .j av a 2 s . c o m*/ if (callback.call(scope || window, element, index, array)) { arrayB.push(element); } } return arrayB; };