Javascript constructor - Use an object?
问题 I'm trying to create a new object by using an already made object. This is what I am trying to achieve: var obj = {"Name" : "Patrick", "Age": 25, "Country": "US"}; document.writeln(JSON.stringify(obj) + "<br />"); function Person(name, age, country) { this.name = name; this.age = age; this.country = country; } document.writeln(JSON.stringify(new Person(obj))); https://jsfiddle.net/dotjz9tb/ As you can see, I am trying to create a new person called Patrick, aged 25, who happens to live in the