Let\'s say I receive some JSON object from my server, e.g. some data for a Person object:
{firstName: \"Bjarne\", lastName: \"Fisk\"}
Now,
In other words you want to change prototype (a.k.a. class) of existing object. Technically you can do it this way:
var Person = {
function fullName() { return this.firstName + " " + this.lastName; }
};
// that is your PROFIT function body:
personData.__proto__ = Person ;
After that if you will get true
on personData instanceof Person