4.2 added

This commit is contained in:
Andrea Bianchi
2026-03-23 23:44:26 +09:00
parent a5b0cc7b8f
commit a869f49907
3 changed files with 59 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
function countDown(n) {
if (n == 0) {
celebrate();
setText('Happy New Year!');
} else {
setText(n);
setTimeout(() => {
countDown(n - 1);
}, 1000);
}
}
const n = 10;
setText(n);
countDown(n);
// Helpers
function setText(n) {
document.getElementById('countdown').textContent = n;
}
function celebrate() {
const jsConfetti = new JSConfetti();
jsConfetti.addConfetti();
}