Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where javascript variables are stored [closed]

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?

like image 728
user3376996 Avatar asked May 05 '14 11:05

user3376996


People also ask

Where are closures stored in JavaScript?

It is created and destroyed every time the function is executed, and it cannot be accessed by any code outside the function.

Where are closure variables stored?

So. With this in mind, the answer is that variables in a closure are stored in the stack and heap.

Where does JavaScript variables get stored?

JavaScript variables get stored in the memory of the browser process.

Which variables are deleted in JavaScript when the page is closed?

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.


Video Answer


1 Answers

JavaScript variables are stored in the memory of the browser process.

There are several kinds of 'variables' you might want to think about:

  1. Variables in JavaScript code, which are saved in the memory of the browser process.
  2. Cookies can also store variables; they are often saved on your hard disk;
like image 77
Patrick Hofman Avatar answered Sep 30 '22 19:09

Patrick Hofman