+ 1
What does these codes do ?
var a = 1; var num = [2, 3, 4, 5, 6, 7, 8]; console.log(num[a++]); and var a = 1; var num = [2, 3, 4, 5, 6, 7, 8]; console.log(num[++a]);
1 Answer
+ 6
a = 1
a++ => 1
num[1] => 3
a = 1
++a => 2
num[2] => 4
pre increment
post increment