"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?