+ 2

I don't get why its output is 10... :

var x=2; for(var i=0; i<4; i++) { x+= 2; } consol.log(x)

25th Jun 2019, 7:48 AM
Boaz Nyagaka
Boaz Nyagaka - avatar
3 Answers
+ 2
You can find more about JavaScript loops here: https://www.sololearn.com/learn/JavaScript/1140/
25th Jun 2019, 7:56 AM
Qbix
Qbix - avatar
+ 1
FYI, You have a typo there: consol.log(x) - > console.log(x)
25th Jun 2019, 7:53 AM
Qbix
Qbix - avatar