0
Does anyone know whatâs wrong with my code?
function person(name,age){ this.name=name; this.age=age; this.yearofbirth=function (){ return 2020-this.age; } var x=new person("me",23); console.log(x.yearofbirth());
2 Answers
+ 4
Yaser You missed one closing brackets }
+ 2
function person(name,age){
this.name=name;
this.age=age;
this.yearofbirth=function (){
return 2020-this.age;
}
} // } missed