+ 2
How it's working?
var sum=0; for (var i = 1; i <=5; i++) { if (i==1) continue; if (i>3) break; sum+=i; } document.write(sum)
8 Réponses
+ 3
You're thinking right ☺
+ 4
I like the fact that you're curious to play around with your codes to see what the output will be when you run the code with errors @Kristina Hakobyan ☺
Usually what I expect to happen when a Javascript code has syntax errors, the code just doesn't simply run but in this case you're just getting an "unexpected result" and that's all there is to it I believe. ☺
+ 3
but I answer 5 here it's accept wrong answer 😂😂😂😁
+ 3
lol I want to know I'm thinking right or wrong because it's important for me lol 😁 thx for support me to understand it
+ 3
thx thx thx thx thx 👍👍👍👍👍🤗🤗🤗👏👏👏👏😊😊😊😊😉😉😉😉
+ 2
Well I believe that your loop executes still be ignores the if statements and then assigns it's final value, which is 5, to sum at the end of the loop and then prints it.
+ 2
Lol well play around with it but if you want a specific result but you don't get what you want then feel free to ask for my help and then I'll help you get the result you want. 😉
+ 1
thx so much but I only what to understand how it's working have a logics