I've been bashing my head against this wall I am completely new to JavaScript coming from c#
and I am completely baffled for my class I have to smooth out a simple code we made to count down from zero by making it into a loop and for the life of me I just cant get it to work
var i = 10;
var timeout = 10000;
var x = 10
if (i == 5)
{
alert("help me")
}
while(i>0)
{
//10
setTimeout(() => { document.getElementById("counter").innerHTML = i;
i = i - 1;}, timeout);
timeout = timeout - 1000;
}