Building Your Learning Module...
Getting things ready for you!
Find videos you like?
Save to resource drawer for future reference!
An object is like a labeled container that holds related information. Think of it like a contact card with name, phone, and email - all the info about one person in one place!
const objectName = {
key1: value1,
key2: value2
};key = property namevalue = the dataStore multiple pieces of related information
object.propertyNameSimple and clean - use when you know the property name
object['propertyName']Use with spaces, variables, or special characters
Get values from objects
obj.newKey = valueCreates new property
obj.key = newValueUpdates existing property
delete obj.keyRemoves property
Add, change, and remove properties
When a function is stored in an object, it's called a method
const person = {
name: 'Alice',
sayHello: function() {
console.log('Hello!');
}
};
person.sayHello(); // Hello!Store functions inside objects
Access nested properties by chaining dots: object.level1.level2
const company = {
name: 'Tech Corp',
address: {
street: '123 Main St',
city: 'Boston'
}
};
console.log(company.address.city);
// Output: BostonObjects containing other objects
Complete user profile with all information in one object
Store related data: { name: "Alice", age: 25 }
Use object.property to get values
Add, change, delete properties anytime
Store functions as object properties