🔥 NEW Code Tidbit Every Week 🔥

# Convert Array-like to True Array

This is cool! Learning something new @wesbos ES6 course 🔥

const nodeList = document.querySelectorAll('ul li');

// Method 1: Convert to true Array
Array.from(nodeList);

// Method 2: Convert to true Array
[...nodeList];

// Now you can use map and other methods to loop

# Resources

  • https://github.com/wesbos/es6-articles/blob/master/25%20-%20Array.from()%20and%20Array.of().md

Related Tidbits