Javascript: Code doesn't work

Hey guys,

I am a beginner in javascript and my code doesn’t work.
Has anyone an idea what is wrong with it?


//die Formel berechnet mit festgelegten Parametern eine Zufallszahl zwischen 10 und 100 (einschließich 10 und 100)
//Formel ausführen und Ergebnis überprüfen
//Überprüft wird mit einer Schleife, die 1 Mio. Mal durchläuft
//Ausreißer in Variablen mitzählen - d.h. ist die Zahl zu klein, zählen und ist die Zahl zu groß, auch zählen


var zufallsZahl;
var anzahlZahlZuKlein = 0;
var anzahlZahlZuGroß =0;

for (i=0; i=1000;i++){
zufallsZahl = Math.random()*90;
zufallsZahl = Math.round(zufallsZahl + 10);

if (zufallsZahl<10) {anzahlZahlZuKlein++;}

if (zufallsZahl>100) {anzahlZahlZuGroß++;}
}

document.write ("Die Zufallszahl war " + anzahlZahlZuKlein +" Mal kleiner als 10.");
document.write ("Die Zufallszahl war " + anzahlZahlZuGroß +" Mal größer als 100.");

Thanks a lot in advance!
Mona

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums

I don’t understand German and I’m not sure what you’re trying to do with your code but on first sight I can see your for loop is invalid.
for (i=0; i=1000;i++){} → should be for (i=0; i < 1000;i++){} .
Check here for more info on for loop.