Extend Constructors to Receive Arguments Color is not defined

Tell us what’s happening:
When I run the test on this challenge the console reads back “color is not defined” I’m not sure what I’ve done wrong. Thanks for your help!

Your code so far

function Dog() {
 this.name = name;
 this.color = color;
 this.numLegs = 4; 
let terrier = new Dog("Ralph","black");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36.

Link to the challenge:

The function should take two parameters (name, color). Currently you do pass these values to new Dog, but your function is not set up take these parameters.


function test(param1, param2){
   console.log(param1);  // logs "first"
   console.log(param3);  // throws an error, because param3 is not in parameter list

test("first", "second");

Thanks Ben. That solved my problem. It was a silly error.

But out of curiosity how come “name” didn’t throw an error but “color” did?

Not sure, but I would guess that the name variable is used somewhere inside the testing or global scope.

right on. thanks again!