Clear Timeout Lab

Easy
21
63.9% Acceptance

In this lab, you will create an HTML page with two buttons and a paragraph. The first button, with id startBtn, should start a timer that will change the content of the paragraph with id timerDisplay every second. The second button, with id stopBtn, should clearTimeout the currently running timer so that the content of the paragraph stops changing.

This lab will help you understand and apply the setTimeout and clearTimeout functions in JavaScript while manipulating the DOM.

Concepts covered:

  • DOM manipulation
  • Event handling
  • setTimeout
  • clearTimeout

At the end of this lab, you should be able to create a simple timer in JavaScript using setTimeout and clearTimeout.