0

What is the difference between primitive data type and reference data type?

data type in javascript

17th Nov 2017, 8:56 PM
NDUNGUTSE Mukosa
NDUNGUTSE Mukosa - avatar
5 Réponses
17th Nov 2017, 9:11 PM
John Wells
John Wells - avatar
+ 3
The difference comes from how they are stored in the RAM. Primitive data types are stored on the Stack, Reference d.t. - on the Heap. Java example: Stack Heap char Objects byte Strings short Arrays int Lists long Maps float double More about the Stack and Heap: http://net-informations.com/faq/net/stack-heap.htm
17th Nov 2017, 9:14 PM
Boris Batinkov
Boris Batinkov - avatar
0
Boris Batinkov Why are String in heap?
8th Feb 2021, 5:28 PM
Aman sharma
0
Aman sharma, Simply said, because a String is like an Array of chars. Check the link about the stack and heap above. It explains the difference between the Stack and Heap, so you'll understand it better.
9th Feb 2021, 12:52 AM
Boris Batinkov
Boris Batinkov - avatar
0
Boris Batinkov thank you 😁
9th Feb 2021, 2:25 AM
Aman sharma