0

I'm always confused with the difference between these two things. I know primitive values are stored on the stack and reference values are stored on the heap. But is it accurate to say that primitive types store primitive values and vice versa with reference types/values?

Thanks

trincot
  • 317,000
  • 35
  • 244
  • 286
urizark
  • 128
  • 1
  • 11
  • 1
    [Types are defined in ECMA-262](https://262.ecma-international.org/#sec-ecmascript-language-types), there is no "primitive type". It defines [primitive values](https://262.ecma-international.org/#sec-primitive-value) as a "*member of one of the types Undefined, Null, Boolean, Number, BigInt, Symbol, or String*", everything else is an Object (including functions, which are callable objects). – RobG Aug 27 '21 at 20:19
  • You know what the difference between a value and a type is in general? No, a type doesn't store anything. – Bergi Aug 27 '21 at 22:04

1 Answers1

1

Hmm ... maybe you have a confusion with "primitive type". Most of the time "primitive type" (or primitive data type) and "primitive values" are used to speak the same things: boolean, null, undefined ...

But you can check these links to know more about it and find a better answer: