As far as I understand, and you can correct me if I'm wrong, when you assign a variable to a function, i.e. create a function expression, the function is not assigned to the variable the same way a primitive value would be. The variable does not hold that function as a container the same way it holds a primitive value, instead, the variable simply makes a reference to that function.
So, if this is correct, I wanna know how does the invocation of a reference actually works. When you do this:
let func = function() {..}
func()
since func
is not a function, but only makes a reference to a function, then how is it being invoked? Are you simply calling on that reference, func
, to invoke the function?
If objects, including functions, can only be referenced, then where are they stored?
Unless it answers those specific questions, please don't bother giving me any external reading sources. I've read a lot already, but non of them actually explicitly answer these questions. They're all vague, and do not provide an explicit clear answer.