I recently added an update to my clock app which adds milliseconds to the clock. But the JavaScript code has not updated.
Code on Glitch:
function startTime() {
const today = new Date();
let h = today.getHours();
let m = today.getMinutes();
let s = today.getSeconds();
let ms = today.getMilliseconds();
h = checkTime(h);
m = checkTime(m);
s = checkTime(s);
ms = checkTime(ms)
document.getElementById('time').innerText = h + ":" + m + ":" + s ;
setTimeout(startTime, 1000);
}
function startMs() {
const today = new Date();
let ms = today.getMilliseconds();
document.getElementById('ms').innerText = ms
setTimeout(startMs, 1)
}
function checkTime(i) {
if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10
return i;
}
startTime()
Code on Website:
/*
This is your site JavaScript code - you can add interactivity and carry out processing
- Initially the JS writes a message to the console, and moves a button you can add from the README
*/
// Print a message in the browser's dev tools console each time the page loads
// Use your menus or right-click / control-click and choose "Inspect" > "Console"
console.log("Hello 🌎");
function startTime() {
const today = new Date();
let h = today.getHours();
let m = today.getMinutes();
let s = today.getSeconds();
h = checkTime(h);
m = checkTime(m);
s = checkTime(s);
document.getElementById('time').innerText = h + ":" + m + ":" + s ;
setTimeout(startTime, 1000);
}
function checkTime(i) {
if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10
return i;
}
startTime()
}
Is there any way to brute update the app?