let spaceship = {
passengers: [
{name: 'Jada'},
{name1: 'Jack'}
],
telescope: {
yearBuilt: 2018,
model: "91031-XLT",
focalLength: 2032
},
crew: {
captain: {
name: 'Sandra',
degree: 'Computer Engineering',
encourageTeam() { console.log('We got this!') },
'favorite foods': ['cookies', 'cakes', 'candy', 'spinach'] }
},
engine: {
model: "Nimbus2000"
},
nanoelectronics: {
computer: {
terabytes: 100,
monitors: "HD"
},
'back-up': {
battery: "Lithium",
terabytes: 50
}
}
};
Usually an object is made by doing let obj = {};
and key:value pairs defined inside the object is made by doing key:value
, so then why do I see objects inside of spaceship
being defined as obj: {}
instead of obj = {}
?
Also, step 2 requires us to make passengers an array with objects inside of it, and the solution is:
passengers: [
{name: 'Jada'},
{name1: 'Jack'}
]
but aren’t objects declared like this: obj = {}
, so shouldn’t it be like this instead:
passengers = [
{name: 'Jada'},
{name1: 'Jack'}
]
Please help!