If you only want to increment a value by 1, you can use the ++ operator. This goes either directly before or after the variable:
ok. got it.
need help here, please
So what’s the difference between putting the ++ operator before or after the variable? The main difference is the value that is returned by the operation. Both operations increase the value of the points variable by 1, but points++ will return the original value then increase it by 1, whereas ++points will increase the value by 1, then return the new value:
Copypoints++; // will return 6, then increase points to 7<< 6
++points; // will increase points to 8, then return it<< 8
i tried this
Code:
<script>
let points = 5;
++points;
alert(points);
</script>
and
Code:
<script>
let points = 5;
points++;
alert(points);
</script>
both came back as 6
confused, please help