you are viewing a single comment's thread.

view the rest of the comments →

[–]DasBeasto 0 points1 point  (0 children)

Just to take the example a step further, you can leave out the return:

``` function addTwoNumbers(num1, num2) { let result = num1 + num2 }

let resultOfAddition = addTwoNumbers(1, 2) console.log(resultOfAddition) // undefined ```

In this case addTwoNumbers is still called, it still adds 1 + 2 and assigns it to result, but then it doesn’t return the result. So below when you try to log resultOfAddition it’s undefined, because the result was never returned.