I am interested in creating a timer/stopwatch using JavaScript for a specific scenario:
When the user clicks the "Play" button, the stopwatch will start counting, and when they click "Pause," it will stop. The difference between the start and end times will give me the elapsed time. I want to display this as the progress time of a song and update it accordingly. If the song has finished playing, the timer should reset to 0; otherwise, it should resume from where it was paused. Can you please provide guidance on how to achieve this functionality in JavaScript? How can I retrieve the current time (using getTime perhaps)?
Thank you,
Sneha