18JavaScript
Objects: Grouping Data with Key–Value Pairs
Easy10MIN
What Is an Object?
An object is a collection of properties. Each property has a key (or name) and a value. Objects allow you to group related data together.
For example:
JAVASCRIPT
1let person = {
2 name: "Alice",
3 age: 25,
4 city: "Wonderland"
5};In this example:
- The variable person holds an object.
- The object has properties with keys name, age, and city.
- Each key is connected to a value (for instance, name is connected to "Alice").
1 / 6
Hakatemia Pro
Learn to hack — start here
Hundreds of interactive courses, virtual labs and CTF challenges in your browser. Start a free trial — no card required.