Skip to content

Instantly share code, notes, and snippets.

@suhailgupta03
Created May 10, 2023 17:01
Show Gist options
  • Save suhailgupta03/0acefdb0077673729e9272f99e70c16b to your computer and use it in GitHub Desktop.
Save suhailgupta03/0acefdb0077673729e9272f99e70c16b to your computer and use it in GitHub Desktop.
var x = 1;
console.log(x++);
// x++ will increment the number
// after it has been printed (any operation)
// which means x will only be incremented after the
// above statement is executed
// value of x after line number 2 is executed is 2
console.log(++x);
// ++x will first increment and then
// print (or let it be used for operations)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment