0

what is output of the code? var sum=o for(i=4;<8;i++){ if (i ==6){ continue } sum+=1 } document write (sum;) ...............?

27th Oct 2016, 9:31 AM
Md.mahadi Hasen
Md.mahadi Hasen - avatar
3 Antworten
+ 7
Ignoring the numerous synthax errors, it would print 3.
27th Oct 2016, 9:51 AM
Zen
Zen - avatar
+ 3
Pls check your Syntax and to complete Zen's correct answer here is an explanation: var sum = 0; for(var i = 4 ; i < 8 ; i++) { if (i == 6) { continue; //'continue' steps over one iteration //therefore var 'sum' is raised by one when //var 'i's value is 4,5 or 7 (example specific) //8 won't be reached obviously } sum += 1; //I'd use: sum++; But it wont matter. } document.write(sum); //output is 3
28th Oct 2016, 7:16 PM
MarquisBs
MarquisBs - avatar
0
There is mistake!
27th Oct 2016, 2:03 PM
Vaclav Kosak
Vaclav Kosak - avatar