num+1 increments the number before the current expression is evaluted so log will be the number after increment, but num++ increments the number after the expression is evaluated, so log will log the num before increment then increment it.
if you like to do the same functionality as num+1 you may use ++num and it will do the same.
They both increment the number. ++i is equivalent to i = i + 1.
i++ and ++i are very similar but not exactly the same. Both increment
the number, but ++i increments the number before the current
expression is evaluted, whereas i++ increments the number after the
expression is evaluated.
See this question
That is not the correct use of ++, but also a lot of people would not recommend using ++ at all. ++ mutates the variable and returns its previous value. Try the example below.
var two = 2;
var three = two += 1;
alert(two + ' ' + three);
two = 2;
three = two++;
alert(two + ' ' + three);
two = 2;
three = two + 1;
alert(two + ' ' + three);