0

uncaught typeError: Person is not a constructor

problem this code:var p1 = new person("John", 42 ,"green"); var person={ name:"John", age:42 , favColor:"green"}; function person(name, age, color){ this.name=name; this.age=age; this.favColor=color; } var p1 = new person("John", 42 ,"green"); var p2=new person("Amy",21,"red") document.write(p1.age); document.write(p2.name);

26th Jun 2020, 5:49 PM
Khabibulla Abdirakhmonov
Khabibulla Abdirakhmonov - avatar
1 Answer
+ 6
Try the same code but only from the "function" part
26th Jun 2020, 6:19 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar