99 Flashcards
(5 cards)
1
Q
Primitive Types (Primitives) in JS
A
Number
String
Boolean
Undefined
Null
Symbol
BigInt
2
Q
Reference Types (Objects) in JS
A
Object Literal
Arrays
Functions
Many More…
3
Q
Primitives are stored in …
Objects are stored in …
A
Primitives are stored in the Call Stack.
Objects are stored in the Heap.
4
Q
What happens when you change the value of a primitive variable and reference variable?
A
- primitive variable: it does not affect any other variables that have the same value
- reference variable: it will affect any other variables that reference the same object or array
5
Q
const me = { name: 'Jonas', age: 30 } const friend = me friend.age = 27 console.log(friend) // (1) console.log(me) // (2)
A
(1)
{name: 'Jonas', age: 27}
(2)
{name: 'Jonas', age: 27}