$ ./guess_the_languageProblem Solving — fix the bug
Problem Solving — fix the bug · easy · #196

Which fix removes the bug?

const items = document.querySelectorAll('li');
const texts = items.map((li) => li.textContent);
  1. Spread into an array first
  2. Use getElementsByTagName
  3. Query with querySelector
  4. Wrap it in a try block
A NodeList has forEach but no map; [...items] or Array.from gives a real array.
Play Problem Solving ▸