4 ms·
Hoping this is just a one time issue, but in the first tutorial: >const keys = document.querySelectorAll('.key'); is provided, but it will trigger an error in
by toxican 10y ago
Hoping this is just a one time issue, but in the first tutorial:
>const keys = document.querySelectorAll('.key');
is provided, but it will trigger an error in the console. As far as the video is concerned this is part of the final code. However, if you look at the starter files, there's a final version of the the code and that line has changed to:
>const keys = Array.from(document.querySelectorAll('.key'));
Which of course works fine. Kind of inconvenient to have to turn to the the source files to learn how to do it right from a video. It may be possible that I just missed a video annotation, which is completely possible given my approach to these kinds of things (code while I watch).
- sscotth 10y agoBrowsers recently added `forEach` methods to NodeLists. Make sure you are using the latest version of your browser. Array.from(...) may make it work with somewhat older browsers. https://developer.mozilla.org/en-US/docs/Web/API/NodeList https://developer.mozilla.org/en-US/docs/Web/API/NodeList