There are two increment operators: prefix and postfix.
The postfix operator increments the variable after it is evaluated. For example, the following code produces 11, because it adds 5 and 6:
var a = 5;
(a++) + (a++)
The prefix operator increments the variable before it is evaluated. Sounds like that is what you want. The following code produces 13, because it adds 6 and 7:
var a = 5;
(++a) + (++a)
So your code should be:
function addOne(num) {
return ++num;
}
console.log(addOne(6));