I know it is stupid, but I cannot figure out where javascript variables are stored: on a hard drive or in RAM? Is there a way to force store to a specific place?
It is created and destroyed every time the function is executed, and it cannot be accessed by any code outside the function.
So. With this in mind, the answer is that variables in a closure are stored in the stack and heap.
JavaScript variables get stored in the memory of the browser process.
Global variables live until the page is discarded, like when you navigate to another page or close the window. Local variables have short lives. They are created when the function is invoked, and deleted when the function is finished.
JavaScript variables are stored in the memory of the browser process.
There are several kinds of 'variables' you might want to think about:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With