I'm returning the subtotal in the `getSubTotal` function but it isn't printing out the result, what's going on?



I’m returning the subtotal in the getSubTotal function but it isn’t printing out the result, what’s going on?


So when a function returns a value it gives that value to wherever that function was called. For instance, there’s a function that multiplies the input by 2 called byTwo. We want to print out 5 byTwo plus 7. We do this like so: console.log(byTwo(5) + 7). Note that where we called byTwo(5) is now replaced by its return value, which is 10. It then adds it by 7 and then prints out the new result. Note that the original return is not printed, the function just returns the return value back to where the function was called.