What is wrong with my code?

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

var rabbit1 = Rabbit("fluffy");
var rabbit2 = Rabbit("happy");
var rabbit3 = Rabbit("sleepy");

What is wrong with my code?
It says “Oops, try again. When checking rabbit1, your code caused the following error: TypeError: undefined is not an object (evaluating ‘rabbits[i].adjective’)”

More Options

Remember to use new when declaring an instance.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.