Skip to content

Instantly share code, notes, and snippets.

@abijaK
Last active December 20, 2022 09:58
Show Gist options
  • Save abijaK/f76bcdc6d9cc6919855f3aa678c32676 to your computer and use it in GitHub Desktop.
Save abijaK/f76bcdc6d9cc6919855f3aa678c32676 to your computer and use it in GitHub Desktop.
Code Javascript
// Declare variables to point to elements
let min = document.getElementById("min");
let sec = document.getElementById("sec");
let startButton = document.getElementById("start");
let breakButton = document.getElementById("break");
let resetButton = document.getElementById("reset");
// Initialization
let initial = {
startTime: 24,
breakTime: 4,
seconds: "00",
}
// Switch on session/break
let timer;
let decrementSec = 59;
// Display on loading
window.onload = () => {
min.innerHTML = initial.startTime + 1;
sec.innerHTML = initial.seconds;
breakButton.style.display = "none";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment