Skip to content

Commit

Permalink
➕ feat: objects
Browse files Browse the repository at this point in the history
  • Loading branch information
linder3hs committed Mar 8, 2024
1 parent c184451 commit ebdb8cd
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions semana-6/objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,21 @@ const person = {
name: "Pepe",
lastname: "Perez",
hasCar: true,
car: {
brand: "Astor Martin",
price: 9999.0,
color: {
variant: "neutro",
hex: "#0000",
},
},
};
// agregando una propiedad
person.address = "av mi casa siempre viva 123";
person["age"] = 99;

console.log("color", person.car.color.hex);
console.log("color", person["car"]["color"]["hex"]);

console.log(person.name);
console.log(person["name"]);
Expand All @@ -16,3 +30,23 @@ const anyData = [1, true, { id: 1 }, "Hola", Symbol("foo")];

console.log(typeof anyData);
console.log(typeof person);

const person2 = {
id: 1,
name: "Pepe",
lastname: "Perez",
hasCar: true,
car: {
brand: "Astor Martin",
price: 9999.0,
color: {
variant: "neutro",
hex: "#0000",
},
},
};

Object.keys(person2.car);
Object.keys(person2.car.color);
Object.values(person2).length;
Object.entries(person2).length;

0 comments on commit ebdb8cd

Please sign in to comment.