Created
November 23, 2012 10:20
-
-
Save hemanth/4134912 to your computer and use it in GitHub Desktop.
arrayfrom vs [].foreach
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 divs = document.querySelectorAll('div'); | |
Array.from(divs).forEach(function (node) { | |
console.log(node); | |
}); | |
var divs = document.querySelectorAll('div'); | |
[].forEach.call(divs, function (node) { | |
console.log(node); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment