Skip to content

Instantly share code, notes, and snippets.

@leongersing
Created December 16, 2009 22:10
Show Gist options
  • Save leongersing/258229 to your computer and use it in GitHub Desktop.
Save leongersing/258229 to your computer and use it in GitHub Desktop.
function Person() {
this.name = arguments[0] || "I don't have a name."
}
Person.prototype.getName = function() {
return this.name;
}
var person = new Person("Sophia");
document.write(person.getName());
var get_your_name_later = person.getName;
//name = "Leon";
document.write("<hr>");
document.write(get_your_name_later());
document.write("<hr>");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment