Created
November 10, 2016 16:17
-
-
Save sapslaj/4d98e0713b4c207393d10326095d1f8f to your computer and use it in GitHub Desktop.
Hack NodeList to use toArray() so you can then use forEach and stuff. Don't use it unless you are a lazy dirtbag though.
This file contains hidden or 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
| // Don't do this. | |
| NodeList.prototype.toArray = function () { | |
| var newArray = []; | |
| for (var i = 0; i < this.length; i++) { | |
| newArray.push(this[i]); | |
| } | |
| return newArray; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment