x++ (post-increment) ≠ x = x + 1
Post increment(x++) not equal to x = x + 1;
let x = 10;
let y = x++;
console.log(y); // 10
console.log(x);// 11
On the above code x++ (post-increment) will increment the original value + 1 and return the initial value not incremented value.
let x = ...
shyam3050.hashnode.dev1 min read