I’m having trouble with 5 tests in the timer section (haven’t worked on audio yet). On searching the forum, I see that one of my issues is that on starting the clock after it has been paused, there is a 1 second delay. Unfortunately, I have been unable to resolve this. There are also some other test failures, but these I do not understand, as the application seems to be doing what is asked. Any help is appreciated.
Current project link: https://codepen.io/importhuman/pen/eYdGpKN?editors=0010
I resolved the issue by immediately calling the callback function of set interval. Also create a named function and return that function for further use.
Something like this.
setInterval(function hello() {
console.log('world');
return hello;
}(), 5000);
I don’t think I understood what you meant? Are these two different things (calling callback of setInterval and creating named function)? And how do I call the callback function of setInterval, doesn’t it have a single function?
As you can see in exmaple code block I have given the call back function a name “hello” and returning hello inside it. After that calling it immediately using ().
Oh, I get what you mean by calling it immediately, but where would I use this function? And I think by using arrow notation I am already calling it immediately, otherwise it wouldn’t change.
