Why is this happening | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is this happening

I just started to learn js and now i'm trying to experiment. When I try to run the code (https://code.sololearn.com/WfFfgdoMAvx7/?ref=app) I see only empty space. First I thought it's happening because there's something wrong with my code. But after that every code I try to run in this app turns out a white screen so it starts to look like an app bug or something.

28th Jan 2020, 9:15 PM
КОнь КонЮв
КОнь КонЮв - avatar
3 Answers
+ 1
for (i=10; i>=4; i-=2) { console.log(i); } have a look at the bottom right where is says "JavaScript Console"
28th Jan 2020, 9:20 PM
rodwynnejones
rodwynnejones - avatar
0
but why did you write "-="? it starts to work after i replaced "i-2" with "i-=2"
28th Jan 2020, 9:28 PM
КОнь КонЮв
КОнь КонЮв - avatar
0
for third argument of for statement . i++ and i-- is post-increment, only used for difference of 1. Other difference more than 1, you need to use assignment statement, such as i=i+3 or i=i-6
28th Jan 2020, 11:13 PM
Gordon
Gordon - avatar