Pedantic Pomodoro Poll

Hi all! (Don’t mind the alliteration!)

I have a pedantic question about setInterval(). I am assuming it allows for arguments to be added at the end to be input in the contained function that executes after the interval because it was specified before arrow functions existed.

My question is why do I fail the tests when not using an arrow function? See line 23 of

Compare the code utilizing the arrow function:

I’m just wondering what’s going on behind the scenes here.

My guess is that the testing suite manually calls setInterval with only the first two arguments and obviously isn’t passing the third argument.

P.S. Pay no attention to the audio tests. I haven’t gotten to them yet.


Read and follow some of the links here and here.

The short answer is you have to handling binding this correctly without the arrow function.

1 Like

But I’m using hooks so no this.

There’s always a this, hook or no. It’s just not always the right one.

1 Like