Given the following code:
function Person(firstName, lastName) {
this.FirstName = firstName;
this.LastName = lastName;
}
Person.prototype.showFullName = function() {
return this.FirstName + " " + this.LastName;
};
var person = new Person("xx", "xxxx");
var jsonString = JSON.stringify(person);
var thePerson = JSON.parse(jsonString);
My goal here was to be able to call "showFullName" on the page. Although I understand that JS has no objects, it should have some way of saying that something needs to be handled in a certain way, like casting thePersonup to Person.
source
share