Skip to content

Commit df01ba7

Browse files
committed
updated prim//val example
1 parent e502905 commit df01ba7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

JavaScript Outlines/ObjOriProg.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,23 @@ Are functions objects?
249249
/*
250250
What is the difference between value(primitive) types and reference types?
251251
////////////////////////////////////////////////////////////////////////////
252+
• VUnderstanding value and refrence types is important for understanding prototypes.
252253
• Value types (primitives) are: numbers, strings, booleans, symbols, undefined, null.
253254
• value types are stored in the variable.
254255
• primitives are copied by thier value.
255256
• Reference types are: objects, functions, arrays.
257+
• primtives are independent
256258
• reference types are NOT stored in the variable... it is stored somewhere else in memory
257259
• objects are copied by thier reference.
258260
*/
261+
let x = 10; // the value of 10 is stored inside x
262+
let y = x; // when x is copied into y, it is copied exactly as 10 into the new variable... it is indpendant now.
263+
264+
x = 20; // so if you change the value of x to 20...
265+
266+
console.log(x) // 20 is the
267+
console.log(y) // 10
268+
259269

260270
/*
261271
How do you add or remove properties?

0 commit comments

Comments
 (0)