I don't know this lesson who correct my code!


#1

function Rabbit(adjective) {
this.adjective = adjective;
this.describeMyself = function() {
console.log("I am a " + this.adjective + " rabbit");
};
}

// now we can easily make all of our rabbits
var rabbit1 = new Rabbit(){
rabbit1.adjective = "fluppy";
rabbit1.describeMyself = function("fluppy"){
console.log("I am a " + this.adjective + " rabbit");
};
}

var rabbit2= new Rabbit(){
rabbit2.adjective = "happy";
rabbit2.describeMyself= function("happy") {
console.log("I am a " + this.adjective + " rabbit");
};
}

var rabbit3 = new Rabbit(){
rabbit3.adjective = "sleepy";
rabbit3.describeMyself = function("sleepy") {
console.log("I am a " + this.adjective + " rabbit");
};
}


#2

Hey @ecln30! This is how you make a new instance/rabbit in your case.

var rabbit2 = new Rabbit();
rabbit2.adjective = "happy";
rabbit2.describeMyself= function("happy") {
console.log("I am a " + this.adjective + " rabbit");

Understand?Comprende? :smile:


#3

why my code still incorrect "SyntaxError: Expected identifier"
how do I fix that ? help me


#4

I'm pretty sure fluppy is meant to be fluffy.