Skip to content

Instantly share code, notes, and snippets.

@kaiquewdev
Created July 15, 2014 20:16
Show Gist options
  • Select an option

  • Save kaiquewdev/234d24d581990b7937b8 to your computer and use it in GitHub Desktop.

Select an option

Save kaiquewdev/234d24d581990b7937b8 to your computer and use it in GitHub Desktop.
var userComponent = {
fullName: function () { return this.firstName + ' ' + this.lastName; },
get: function (key, value) { return this[key] || (value || ''); },
};
var evandro = Object.create(userComponent, {
'firstName': { value: 'Evandro', enumerable: false },
'lastName': { value: 'Ribeiro', enumerable: false }
});
console.log(evandro.fullName());
console.log(evandro.get('firstName'));
console.log(evandro.get('lastName'));
console.log(evandro);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment