Do you know what will be the output of this code?
JavaScript
let a = 1;
const b = a++;
console.log(a, b);
Show answer and explanation
The answer is 2 1.
Postfix a++ returns the current value (1) and then increments a to 2. Prefix ++a would increment first and return 2.