File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -16,9 +16,17 @@ console.log(foo + ' ' + bar); // 'hello world'
16
16
</javascript >
17
17
18
18
<javascript caption =" Incrementing and decrementing " >
19
+ The pre-increment operator increments the operand before any further processing.
20
+ // pre-increment
19
21
var i = 1;
20
- var j = ++i; // pre-increment: j equals 2; i equals 2
21
- var k = i++; // post-increment: k equals 2; i equals 3
22
+ console.log(++i); // => 2
23
+ console.log(i); // => 2
24
+
25
+ The post-increment operator increments the operand after processing it.
26
+ // post-increment
27
+ var i = 1;
28
+ console.log(i++); // => 1. This is because i was processed first
29
+ console.log(i); // => 2. This is because the operand was incremented after processing in the previous step.
22
30
</javascript >
23
31
24
32
## Operations on Numbers & Strings
You can’t perform that action at this time.
0 commit comments