Can't figure out why my Js doesn't work as one

Hi, I’m learning JS and I thought doing a simple project is the best way to learn. So I’m trying to replicate this project (
Here is my code:
it seemed alright until I tried to activate the button and the 'set up time ', the image and message don’t change as it supposes to. I can’t figure out why. Please help.

Edit: finally figure it out:

I’ve taken a quick glance at your code and noticed some issues, none of which actually solve your problem but it might make sense to check:

In your startTime function, you set a timeout running after 200ms, where the function calls itsself again. Which leads to more and more function calls… I’m pretty sure you’d prefer to put the closing brackets of the function right after where you write the clock into the HTML (before you declare var t).

Also, the template you’ve posted sets up an interval to call the updateClock function every second. That part seems missing in your code.

And finally, you might want to put the closing body tag at the end of your HTML, not right in the middle … :smiley:

Hi, thanks for your input. It’s actually helped me a lot. After reading your comment, I’ve checked again my HTML , move my var out of my function local scope and add 'Setinterval '. And it worked!