Here's an example of addOne(), constructed as a function expression:
const addOne = function(val) {
return ++val
}
Function expressions should use const in the expression, though it is not syntactically incorrect to use var or let.
What's the difference between declarations and expressions? The core difference is that a function declaration can be used anywhere in your program because it's hoisted to the top. As JavaScript is interpreted top-down; this is a major exception to that paradigm. So, conversely, using an expression must occur after the expression is written.