the following code gives me a Uncaught TypeError: Illegal invocation:
document.querySelector("h1").addEventListener('click', function(evt) {
setTimeout(this.classList.add, 2000, "bold-h1");
});
But what's wrong with it? Wouldn't that be the same as if I would write
document.querySelector("h1").addEventListener('click', function(evt) {
setTimeout(() => { this.classList.add("bold-h1"); }, 2000);
});
? (the latter works by the way)