Objectives Helps

Hi everyone

could someone please help me with my code?

let fasterShip = {
  'Turbo Fuel' : 'Turbo Fuel',
  color: 'spaceship'
}

if someone could get back to me as soon as possibl

that would be much appreciated

Thanks

What’s the problem with your code?

1 Like

The console says in red, that 'Your fasterShip object should have the key of color set to the value of ‘silver’

It is useful to include a link to the relevant exercise: Creating Object Literals

The instructions aren’t asking you to set the color as the string 'spaceship'.

Instead, the instructions specify:

"…with the same color as spaceship …`

// You wrote:
color: 'spaceship'

// Instructions want fasterShip to have the same color 
// as you assigned in the spaceship object:
let fasterShip = {
  color: 'silver',
  'Fuel Type': 'Turbo Fuel'
};

1 Like

Thank you so much
Tip noted and i will include the lesson next time

Hello everyone, I now need help with a new lesson named ‘Accessing Properties’
here is the link for the lesson: https://www.codecademy.com/courses/introduction-to-javascript/lessons/objects/exercises/object-property-access

And I need help with question number 1

Can you share your attempted solution (your code) and the error message being given as feedback?

never mind

I have figured it out

if I have any more questions, I will post them here

Hello everyone, I have another question

Here is the link: https://www.codecademy.com/courses/introduction-to-javascript/lessons/objects/exercises/object-property-access-ii

Here is the code

let spaceship = {
  'Fuel Type' : 'Turbo Fuel',
  'Active Mission' : true,
  homePlanet : 'Earth', 
  numCrew: 5
 };

let propName =  'Active Mission';

// Write your code below
var isActive = spaceship['Active Mission'];
propName =  console.log('Active Mission');

I need help with the second question

Please reply asap if you can

Have you looked at the the hint for the Step?

scrn1

spaceship is the object. It has four properties. One of the properties is named 'Active Mission' and the value assigned to this property is the boolean true.
Step 2 wants the value of this property to be logged to the console.

Using bracket notation, we could access this value by:

console.log(spaceship['Active Mission']);

but, the string 'Active Mission' has been assigned to the variable propName as well. Step 2 wants us to use this variable instead of using the string directly,

console.log(spaceship[propName]);

Your attempted solution

propName =  console.log('Active Mission');

is just printing the string 'Active Mission' and then assigning the return value of the console.log statement to the propName variable. So, propName will end up being assigned the value undefined. This is not what has been specified in Step 2.

thank you so much
that really helped a lot

But I once again need help with another question

Link: https://www.codecademy.com/courses/introduction-to-javascript/lessons/objects/exercises/nested-objects

Code: let spaceship = { passengers: null, 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 } let capFave = captain('favourote foods'); } };

i didnt really type the code properly

Code: let spaceship = {
passengers: null,
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
}
let capFave = captain(‘favourite foods’);
}
};