JavaScript Lab FAQ
- How can I debug JavaScript?
-
You can write to the console
using
console.log(message)
You can also use the developer tools and set breakpoints in the JavaScript code and view the variables.
- Why can't I use a for-each loop with
getElementsByTagName
- The for-each loop can only be used on Arrays, Maps, and Sets. An HTMLCollection is an array-like object (but not an Array).