JavaScript Objects lesson 2/11

I am currently taking the course on JavaScript and I have reached lesson Objects n° 2/11. The 3rd question is not validating even though I think I have written the correct code, which is:

let robot = {
model: ‘1E78V2’,
energyLevel: 100,
provideInfo() {
return I am ${this.model} and my current energy level is ${this.energyLevel}.
}
};

console.log(robot.provideInfo());

Can someone help me or send me the solution? Thank you.

Please format your code:

And please post a link to the lesson so we can see the instructions. The syntax of your code seems ok as far as I can tell from the unformatted code, but you might have missed something from the instructions.

Third: Can you post a screenshot of the error?

2 Likes

this is the link: https://www.codecademy.com/courses/introduction-to-javascript/lessons/advanced-objects/exercises/adv-this

and this is a error message: Did you call console.log() and pass in robot.provideInfo() ?

I can’t see what you did wrong, so I guess that is the validation being nitpicky. You could try to use simple quotemarks rather than backticks for the other properties.

it’s always wrong :confused: i think the console.log(robot.provideInfo()); is correct but the system say: " Did you call console.log() and pass in robot.provideInfo() ?"

I haven’t tried resetting the exercise, but originally wasn’t it?

const robot = {

In your code, you have

let robot = {
2 Likes

Good point. The instructions don’t explicitly say the keyword needs to be const, but this is the provided starting code:
Bildschirmfoto 2023-03-10 um 11.44.07

Yes! That was it, thank you.

1 Like