Working with Objects
Swipe um das Menü anzuzeigen
Objects are used to store related data together.
Instead of using separate variables, you group information into a single structure.
const user = {
name: "John",
age: 25,
isAdmin: false
};
Each value inside an object is stored as a key-value pair.
You can access data using the key:
1234567const user = { name: "John", age: 25, isAdmin: false }; console.log(user.name);
You can also update values:
123456789const user = { name: "John", age: 25, isAdmin: false }; user.name = "Peter" console.log(user.name);
And add new ones:
123456789const user = { name: "John", age: 25, isAdmin: false }; user.email = "john@example.com"; console.log(JSON.stringify(user));
Objects are widely used in backend development because they represent real data, such as users, products, or orders.
War alles klar?
Danke für Ihr Feedback!
Abschnitt 1. Kapitel 6
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Abschnitt 1. Kapitel 6