Objects
JavaScript objects are like labeled containers that hold related items. Think of them as:
Digital storage boxes where you keep related things together
Collections of name-value pairs (like key:value)
Custom blueprints for creating specific things
For example, a dog object might contain:
let dog = {
name: "Rex",
age: 3,
bark: function() { alert("Woof!"); }
};
You access properties using dot notation (dog.name
) or bracket notation (dog["name"]
). Objects can contain basic data, other objects, or functions (methods).
References
Last updated