We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4dc2d9f commit 8aa8f4eCopy full SHA for 8aa8f4e
content/javascript-101/operators.md
@@ -16,9 +16,17 @@ console.log(foo + ' ' + bar); // 'hello world'
16
</javascript>
17
18
<javascript caption="Incrementing and decrementing">
19
+The pre-increment operator increments the operand before any further processing.
20
+// pre-increment
21
var i = 1;
-var j = ++i; // pre-increment: j equals 2; i equals 2
-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.
30
31
32
## Operations on Numbers & Strings
0 commit comments