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

291
Views
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
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!