Preview:
/*
The ++ operator increments the stored number by 1. If the ++ operator comes after the variable (e.g., counter++), the variable's value is returned first and then incremented:
*/

let counter = 0;
//=> undefined

counter++;
//=> 0

counter;
//=> 1

/*If the ++ operator comes before the variable (e.g., ++counter), the variable's value is incremented first and then returned:*/

let counter = 0;
//=> undefined

++counter;
//=> 1

counter;
//=> 1
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter