Premium Only Content
 
			Learn JavaScript NESTED OBJECTS easy! 📫
00:00:00 example 1
00:04:24 example 2
// 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);
- 	
				 LIVE LIVELFA TV15 hours agoLIVE & BREAKING NEWS! | FRIDAY 10/31/253,667 watching
- 	
				 LIVE LIVEThe Mel K Show1 hour agoHunters Become the Hunted: A Reckoning Is Finally Coming - 10/31/25760 watching
- 	
				 LIVE LIVEOutspoken with Dr. Naomi Wolf1 hour ago"The Devil His Due"128 watching
- 	
				 1:02:27 1:02:27VINCE3 hours agoA Very Trump Halloween | Episode 159 - 10/31/25139K75
- 	
				 2:07:18 2:07:18Badlands Media11 hours agoBadlands Daily: October 31, 202551.9K14
- 	
				 1:34:28 1:34:28Graham Allen4 hours agoSCARY: Kamala Had MELT DOWN Over Trump!! Does LSU Hate Charlie Kirk?! + Top Halloween Movies Of ALL TIME!!87K47
- 	
				 1:35:13 1:35:13Caleb Hammer2 hours agoShe Blames MAGA For Her Debt | Financial Audit12.2K1
- 	
				 1:10:40 1:10:40The Big Migâ„¢4 hours agoWhat To Give The Man Who Has EVERYTHING!12.9K13
- 	
				 1:32:16 1:32:16Benny Johnson3 hours agoSHOCK: Massive Food Stamp FRAUD Exposed: 59% of Welfare are Obese Illegal Aliens!? Americans RAGE…40.2K80
- 	
				 2:59:52 2:59:52Wendy Bell Radio7 hours agoAmerica Deserves Better51.2K76