Created
September 14, 2019 16:25
-
-
Save NyaGarcia/b6fbb48e32197620bf31eb6cd96bdeb0 to your computer and use it in GitHub Desktop.
Converting a nodeList to array with the spread operator
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
const nodeList = document.getElementsByClassName("pokemon"); | |
const array = [...nodeList]; | |
console.log(nodeList); //Result: HTMLCollection [ div.pokemon, div.pokemon ] | |
console.log(array); //Result: Array [ div.pokemon, div.pokemon ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment