Question
Why am I getting an output of [Function: sayHello]
instead of of the return
statement?
Answer
Since sayHello is a function, we need to add parentheses ()
in order to call the function. Without the parentheses, we are only making a reference to the function, which is why you are getting that output.