Object

An object groups related data (properties) and actions (methods) together into a single value, often modelling a real-world thing.

General Programming

Objects are central to object-oriented programming. A 'Car' object might hold properties like colour and speed, and methods like drive() and brake().

Examples

JavaScript

const car = { brand: "Toyota", speed: 120 };
console.log(car.brand);

Output:

Toyota

Python

car = {"brand": "Toyota", "speed": 120}
print(car["brand"])

Output:

Toyota

See also

Back to the Dictionary