why does my clearInterval not clear the interval? – JavaScript

I got two intervals, one is inside the other: function start(start) { if (start) { firstInterval = setInterval(function () { console.log("firstInterval called") secondInterval = setInterval(function(){ clearInterval(secondInterval) secondInterval = null console.log("secondInterval called") },1000) }, 1000) }else{ clearInterval(firstInterval) firstInterval = null clearInterval(secondInterval) secondInterval = null } } the else block gets called when I press a "stop"… Read More why does my clearInterval not clear the interval? – JavaScript

SetInterval, clearInterval – How to display image for set time then make it disappear

I am trying to add a feature to my game where an img appears after a set amount of time. The is only displayed for a set time before it disappears again or until it is clicked. Here is my code below but it doesn’t work because the clearInterval is ending the disappear function before… Read More SetInterval, clearInterval – How to display image for set time then make it disappear

Hide AND unhide a <div> or <form> while executing code (progress bar a.o.)

the goal is to hide a form, do some stuff and unhide the form again. For example with this code for a progress bar I thought to do the following but the hiding/unhiding doesn’t work. I’m probably overseeing something obvious. <!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Progress Bar Demo</title> <script> var button; var count;… Read More Hide AND unhide a <div> or <form> while executing code (progress bar a.o.)