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

132
Views
JavaScript variable memory allocation

At what stage is the memory allocated to variables in JavaScript with respect to declaration and initialization?

console.log(a); // Prints undefined
var a;
a = 20;

For the above snippet, a = undefined even before the code execution starts. Does that imply that memory has been allocated during the creation of the variable environment with no value (undefined)? If yes, during code execution phase when the JavaScript engine comes across a = 20 does a new memory block gets allocated to 20 to which a points?

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!