From what I understand, and please correct me if I'm mistaken, when a variable is assigned to a function in the form of a function expression, it doesn't hold the function in the same way that it holds a primitive value. The variable simply references the function instead of containing it.
So, if this is true, I am curious about how the invocation of a reference actually functions. For example:
let func = function() {..}
func()
Given that func
is not the actual function but just a reference to it, how does it get invoked? Is calling on the reference, func
, all that's needed to invoke the function?
If objects, including functions, can only be referenced, then where are they stored?
Unless these specific questions are addressed, please refrain from providing external reading sources. I've already done a lot of research, but none have given me a clear answer to these particular queries. They tend to be vague and lack explicit explanations.