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

237
Views
When saying var something = null is there still a space carved out in memory for the variable even though the value of null is nothing

"In JavaScript, when we create variables, functions, or anything you can think of, the JS engine allocates memory for this and releases it once it's not needed anymore. Allocating memory is the process of reserving space in memory, while releasing memory frees up space, ready to be used for another purpose."

I know that the way the interpreter stores null is 000 which is a "bug" because null typeof is an object.

But when you declare var something = null is there space allocated to memory because you have declared a variable even though the value of null is nothing.

I understand primitive values are allocated on the stack, objects/arrays are located on the heap.

So what happens when null is assigned to a variable? Does the variable have a reference to an empty object on the heap? How does this cycle work?

about 4 years ago · Santiago Trujillo
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!