0
Error in JavaScript
Heeeeelp... I don't know why, but it doesn't work. https://code.sololearn.com/ct0zw7757cBx/?ref=app
4 Answers
+ 4
ㅤㅤㅤ ,
i am not sure if you are aware, that there are 2 different ways, how and when the increment / decrement will be done:
>>> increment operators:
> a++ is called *post increment*. when using this notation, the value of *a* is used as it is, maybe in an expression, and increment is done *after* this.
++a is called *pre increment*. when using this notation, the value of *a* will be incremented first, and then is maybe used in an expression.
According to the description above, the decrement is also carried out in this way.
+ 1
console.log(arr[a][b]);
console.log('\nTest');
a++; b++;
console.log(arr[a][b]);
b-=2;
console.log(arr[a][b]);
Or
console.log(arr[a][b]);
console.log('\nTest');
console.log(arr[++a][++b]);
console.log(arr[a][b-=2]);
+ 1
Eduardo Bresolin
It works, thanks!
0
Lothar
Yes... but... it has decreased, not increased. And this is not normal...