{ Javascript snippets }

Wes Bos

Wes Bos @wesbos

? If you are trying to debug something in the middle of chaining array methods, just map over it, console.log, and return it. Since console.log returns nothing, it will just pass the entire array through. You can even make a handle little debug function ? https://t.co/HCtLh4QYm6

TIL: `document.getElementsByClassName()` & Co return _live_ `NodeList`s. `document.querySelectorAll()` returns a _static_ `NodeList`. Use `querySelectorAll()`, people! https://t.co/s7aGuxMGgN

Kyle Pollich

Kyle Pollich @kylepollich

Nifty trick I've seen around and heard about on @syntaxfm - Array.from({ length: n }) gives you an array full of undefined that you can use in place of traditional for loops. Super handy for executing something a set number of times! https://t.co/AyUK8HtETe