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());

27th Dec 2020, 4:38 AM
Lenoname
2 Answers
+ 4
Yaser You missed one closing brackets }
27th Dec 2020, 4:43 AM
AÍąJ
AÍąJ - avatar
+ 2
function person(name,age){ this.name=name; this.age=age; this.yearofbirth=function (){ return 2020-this.age; } } // } missed
27th Dec 2020, 4:45 AM
Vadivelan