Created
February 28, 2016 13:57
-
-
Save thiagotpc/a6a6e330e1419cce3cb9 to your computer and use it in GitHub Desktop.
Add array methods to NodeList
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arrayMethods = Object.getOwnPropertyNames( Array.prototype ); | |
arrayMethods.forEach( attachArrayMethodsToNodeList ); | |
function attachArrayMethodsToNodeList(methodName) | |
{ | |
if(methodName !== "length") { | |
NodeList.prototype[methodName] = Array.prototype[methodName]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment