Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

156
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda