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

302
Visualizações
Is it possible to pass a primitive value (number or string) by reference in the parameters of a function in JavaScript?

Is this possible? My purpose is to pass text variables and / or numbers with large sizes, therefore, if I pass a large value to the parameters in a function call, in order to make validations (validate messages, scores , etc. of great length) Is this value copied ?, that is, Would it be using twice the memory ?, Does JavaScript at this point do any String Interning or references for the primitive values internally?

For example, strings are immutable, therefore, wouldn't it be silly to pass a copy in the parameters, or if they are passed by reference?

In the case of numbers, likewise, if I only want to use (not manipulate) a number inside a function, is this number also passed as a copy or is it a reference internally?

So is this possible in JavaScript?

Hope you can help me understand c:

about 4 years ago · Juan Pablo Isaza
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