+ 1
What is the wrong with this code?
function person(name,age,color) { this.name = name; this.age = age; this.color = color; }; var p1 = new person("Sam",24,"blue"); var p2 = new person("Moshahed",25,"red"); var p3 = new person("Somrat",24,"green"); document.write(p1.name); document.write(p2.age); document.write(p3.color); Uncaught TypeError: person is not a constructor
4 Answers
+ 2
Code runs just fine, I tested it in browser and SoloLearn app, no problem 🤔
+ 2
But when I run this code in my Google Chrome browser it says error
+ 1
Can you explain how you are running the code in your browser?
There are different steps to take to run it in browser.
+ 1
Moshahed Somrat
Tell me what error message is?



