Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

157
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda