DEV Community

Discussion on: JavaScript — Back to Basics: Prefix vs. Postfix

buntine profile image
Andrew Buntine

Nice article! This is thanks to C and has always been a gotcha in every language that implemented it.

Although, because of the semantic difference and the confusion it can cause, you will very rarely see auto-increment used inside other expressions in typical industry code - it would never pass a code review. You will see the postfix variant from time to time, but it's typically just run as a single statement on it's own line for the the side-effect (+ 1).