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

Which fix removes the bug?

const el = document.getElementById('save');
el.addEventListener('click', handleSave());
  1. Pass the function, not a call
  2. Wrap the handler in async
  3. Use onclick instead
  4. Query with querySelector
The parentheses invoke handleSave immediately and register its return value as the listener.
Play Problem Solving ▸