Help to add a timer in a js quizz

I am developing a test application for my school in which the iq is measured, so far, I have been able to make an array with the question, 6 options and a correct answer and display it to the user, but I have been asked to add a clock that limits the access of the test to 40 minutes and that it sends the result when reaching the time limit to the database (my sql, innodb engine). I’m very new to using Javascript so I can’t give myself an idea of ​​how to integrate this into my project and I can’t find tutorials in spanish/english. I was hoping that someone could give me an example.

I have a repository at GitHub at https://github.com/Strider64/theMiniaturePhotographer/blob/main/assets/js/game.js that is developed in Vanilla Javascript. It just needs polishing, but it might give you an idea where to start. You can see it in action at https://www.miniaturephotographer.com/game.php

1 Like