Can you someone tell me whats wrong with my code?

class car {
    constructor(color,brand,engine){
        this._color = color;
        this._brand = brand;
        this._engine = engine;
    }
    get specs() {
        return `Your car is ${this.color} color, your brand is ${this.brand} and your engine has ${this.engine} of power`;
    }

    set specs(colorInput){
        this._color = colorInput;
        this._brand = brandInput;
        this.engine = engineInput;
    }
}

const myCar = new car("orange","Suzuki","89bhp");
console.log(myCar.specs);

Is this one of the FCC challenges? Can you post a link to the challenge if so.

what are the _ used for? are you missing any?

Your class values don’t match:
they are all initialised with an underscore

this._color
this._brand
this._engine

So here

Your car is ${this.color} color, your brand is ${this.brand} and your engine has ${this.engine} of power

the names don’t match :slight_smile:
Hope this helps :+1:

1 Like

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums

1 Like