array-filter-n
The filterN() method creates a new array with the first N elements that pass the test implemented by the provided function. Fast!
Syntax
filterN(inputArr, N, checkFn[, thisArg])
The checkFn is the standard EcmaScript function (elem, index, array)
thisArg
if supplied is set as the this
context for checkFn
.
Usage
var filterN = ; var filter4even = ;//=> [12, 8, 0, 4] // works also on stringsvar filter3nums = ;//=> [0, 3, 0] // Fastened safety beltsvar first4pallindromes = ;//=> ['aba', 'pop'] var crazy = ;//=> [] var notSoCrazy = ;//=> [1, 2, 3]