I have this code:
function geno(name, obj, parent) {
parent = parent || null;
window[name] = function() {
if (parent){
parent.call(this);
}
for (name in obj) {
this[name] = obj[name];
}
}
if (parent) {
window[name].prototype = Object.create(parent.prototype);
}
}
I want to be able to take this data
{Person:{name:"Sherlock Holmes",address:"221b Baker St."}
And turn it into the class
function Person() {
this.name = "Sherlock Holmes";
this.address = "...";
}
and have it be a named function. Currently, it's an anonymous function. Is there a method of doing this that creates a named function instead?