Skip to content

Instantly share code, notes, and snippets.

Last active Dec 9, 2018
What would you like to do?
One of the less popular way to deal with objects in Javascript that I love
var personHelper = {
init: function(name, nick) { = name;
this.nick = nick;
identify: function() {
console.log( "I am " + + " and my nickname is " + this.nick);
var person = Object.create(personHelper);
person.changeNick = function(nick) {
this.nick = nick;
var laura = Object.create( person );
laura.init( "Laura", "javaScripter89");
var mario = Object.create( person );
mario.init( "Mario", "csharperr80");

This comment has been minimized.

Copy link
Owner Author

@pimoGit pimoGit commented Dec 9, 2018

This is a gist just to be embedded in a nice way, into my post titled: "WRITING JAVASCRIPT THAT ACTS LIKE JAVASCRIPT
Behavior Delegation - OLOO pattern."
This part is the "OLOO way" that I love.
This is compared with the previous here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment