JS Memory allocation
1) Javascript has 5 primitive types data types. Boolean, null, undefined, String, and Number. [ That are passed by value]
2) Javascript has 3 data types that are passed by reference: Array, Function, and Object. These are all technically Objects, so we’ll refer to them collectively as Objects.
JavaScript engines have two places where they can store data: The memory heap and stack.
Heaps and stacks are two data structures that the engine uses for different purposes.
Stack
Primitive values and references ,Size is known at compile time,Allocates a fixed amount of memory
Heap
Objects and functions Size is Known at run Time . No limit per object .