Think about things people see every day, like cars, shops, and birds. These are all objects: tangible things people can observe and interact with.
What are some qualities of these objects? A car has wheels. Shops sell items. Birds have wings. These qualities, or properties, define what makes up an object. Note that similar objects share the same properties, but may have different values for those properties. For example, all cars have wheels, but not all cars have the same number of wheels.
Here's an example using these concepts to create a dog object:
let dog = {
name: "Anakin",
numLegs: 4
};
- This
dog
object has two property/value pairs: aname
ofAnakin
and anumLegs
of4
.
Top comments (0)