// nested objects = Objects inside of other Objects. // Allows you to represent more complex data structures // Child Object is enclosed by a Parent Object // Person{Address{}, ContactInfo{}} // ShoppingCart{Keyboard{}, Mouse{}, Monitor{}} class Person{ constructor(name, age, ...address){ this.name = name; this.age = age; this.address = new Address(...address); } } class Address{ constructor(street, city, country){ this.street = street; this.city = city; this.country = country; } } const person1 = new Person("Spongebob", 30, "124 Conch St.", "Bikini Bottom", "Int. Waters"); const person2 = new Person("Patrick", 37, "128 Conch St.", "Bikini Bottom", "Int. Waters"); const person3 = new Person("Squidward", 45, "126 Conch St.", "Bikini Bottom", "Int. Waters"); console.log(person1.name); console.log(person1.age); console.log(person1.address); console.log(person1.address.street); console.log(person1.address.city); console.log(person1.address.country);
@piotrmazgajАй бұрын
This is my seal. I have watched the entire video, understood it, and I can explain it in my own words, thus I have gained knowledge. This is my seal.
@gobicorner10 ай бұрын
played well
@saxa349510 ай бұрын
Cool
@akj33887 ай бұрын
Can you insert an object into another object just like array.push method?
@visuals42010 ай бұрын
You're a g bro
@STR-DP6 ай бұрын
37😄
@gobicorner10 ай бұрын
what's in bikini button inside objects inside object nice example
@Андреич-с4н6 ай бұрын
Thanks, this is clear. Now I wanted to apply this to graphics. If I want to create a smile icon as an object and the eyes and the mouth to be nested objects so that the icon moves along X or Y or Z axis, or rotates, the eyes and mouth moves with it - how shall I approach this?