Javascript: Error in simple loop
I wrote the following code when I practiced loops: var num = 2; for (;num <= 100; num + 10) { document.write(num + "<br/>"); } What I thought I was doing: I thought I was assigning the value 2 to a variable named num. With the keyword "for" I initiate the loop. Statement1 I left out, because I already assigned the variable. So: for (; statement2, statement3) statement2 defines the conditions under which the loop runs So: var num = 2 for (; num <=100; statement3) The statement3 defines the statement to be executed at each operation until the statement2 is reached. So: var num = 2 for (; num <=100; num +10) This is followed by the instruction to write the result of each operation into the Html document net with a line break. So: { document.write(num + "<br/>"); All in all: var num = 2; for (;num <= 100; num + 10) { document.write(num + "<br/>"); } Well, but... It's not really working at the moment ^^ Bonus would be, if someone else can tell me how to avoid such crashes in the future. This will help you from learning when you have to reboot. I thought this would not happen in the secure environment of SL. The browser reports: A page is slowing down your computer, would you like to stop it? But whether I enter stop or wait, the PC freezes after and after. Happens to me on my own html page under Debian Linux and on the page of SL which I had opened with WIndows for testing. I would test it on a third system, but at the moment I am not allowed to access my wife's computer :D Well, he who does nothing, does nothing wrong. Any help or advice would be great.