+ 2

Hi, what do i miss?

function factor(x) { z=1 for(i=1; i <=x; i++){ z=z*i; } document.write(x); } var y = prompt("blabla?"); if (y>=o){ factor(y); } else document.write("blibli");

15th Apr 2017, 8:04 PM
Pozik
Pozik - avatar
2 Antworten
+ 8
1) "y >= o", thats an o (letter) not a 0. 2) "document.write(x);" Did you want to show the factorial? So: document.write(z); *Try using proper naming conventions to avoid this confusion. 3) i needs to be a var, for(var i = 1; etc..) same with z, var z = 1;
15th Apr 2017, 8:22 PM
Rrestoring faith
Rrestoring faith - avatar
+ 3
ohh, thanks. Now it working))
15th Apr 2017, 8:25 PM
Pozik
Pozik - avatar