Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

150
Views
When you invoke a reference to a function, are you invoking the function yourself, or are you calling on the reference to invoke the function?

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.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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.

Not sure about your terminology of "makes a reference" here. A variable always holds a value. That value might be either a primitive value or a reference value (i.e. an object reference).

If objects, including functions, can only be referenced, then where are they stored?

Simply elsewhere in memory. It gets created by the object literal expression or function expression, and can be referenced one or many times. Objects are garbage-collected automatically in JavaScript.

How does the invocation of a reference actually work? Are you simply calling on that reference, func, to invoke the function?

Yes, you're simply calling on that reference, which will run the code that is part of the function object.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!