Implementation of standard Array methods (introduced in ECMAScript 5th edition) and shorthand generics (JavaScript 1.8.5) Works in all browsers that supports JavaScript 1.2
function isElement(element) { return element.nodeType === 1; } // example #1 console.log( // generic .filter() Array.filter(document.childNodes, isElement) ); // example #2 console.log( // generic .slice() and standard .filter() Array.slice(document.childNodes).filter(isElement) );| Mutator | Accessor | Iteration | Other |
|---|---|---|---|
| pop | concat | forEach | isArray |
| push | join | every | |
| reverse | slice | some | |
| shift | indexOf | filter | |
| sort | lastIndexOf | map | |
| splice | reduce | ||
| unshift | reduceRight |