+ 1

How does JavaScript allocate memory space for its variables?

In Java, a variable name must be declared with any of the primitive data type such as int, short, long, float, double, etc. Each has a specific amount of memory that it can accommodate, like int takes 32 bits of memory and long takes 64 bits(if I'm right). How does JavaScript handle this since most of it's variables are declared with keyword 'var'?

8th Aug 2019, 12:14 PM
Akindele Olawole
Akindele Olawole - avatar
1 Resposta
0
Memory is automatically allocated in JS, when objects are created and freed by garbage collection when they are not used anymore.
8th Aug 2019, 12:29 PM
Michael
Michael - avatar