976 B
976 B
Chapter 5: JavaScript Objects
Object Basics
Create objects:
let object_name = {
property_1_name: property1_value,
property_2_name: property2_value,
}
To access a single property, using .
(dot) operator
Check code in object-101.js
Using Objects with Functions
Parse objects into function just like normal number, it allow us to parse multiple values into function as a single value. Or get multiple values as single value from a function
Exmple check object-function.js
Object References
When a object is parsed as argument into function, it's parsed as reference (not as a copy). Changes done by function on object affect original object
But when a new value to the argument (in function), it break the binding (pass as reference) within function. But does not affect the original object
Example check object-references.js