Skip to content

Instantly share code, notes, and snippets.

@danielearwicker
Created February 16, 2013 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielearwicker/4966671 to your computer and use it in GitHub Desktop.
Save danielearwicker/4966671 to your computer and use it in GitHub Desktop.
Object instances without using this/new/prototype
var person = function(firstName, lastName) {
return {
getFullName: function() {
return firstName + ' ' + lastName;
},
setFirstName: function(newName) {
firstName = newName;
},
setLastName: function(newName) {
lastName = newName;
}
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment