0

why the result is 8??

var a = 6; var b = 3; b--; document.write(a+b);

15th Oct 2016, 5:26 PM
Infoore
Infoore - avatar
5 Respostas
+ 7
because b--; change the value of b from 3 to 2... remember: "b--;" is the same as if you typed "b=b-1;"... when you get to the next line, a+b is equal to 6+2 which gives you 8 as a result.
15th Oct 2016, 5:34 PM
Nelson Urbina
Nelson Urbina - avatar
+ 1
var a = 6; var b = 3; b--; // b become 2 after this line document.write(a+b); // 6 + 2
20th Oct 2016, 6:41 PM
[No Name]
+ 1
6+2
5th Nov 2016, 3:23 AM
luoluo
0
The result 8 of what?
15th Oct 2016, 7:27 PM
nadia
0
yes please upvote :)
15th Oct 2016, 7:38 PM
Can
Can - avatar