Skip to content

Instantly share code, notes, and snippets.

View noherczeg's full-sized avatar

Norbert Csaba Herczeg noherczeg

View GitHub Profile
@noherczeg
noherczeg / composition.js
Created July 13, 2017 00:07 — forked from branneman/composition.js
OO JavaScript: Inheritance vs. Composition
//
// hasPosition trait
//
const hasPosition = state => ({
setPosition: function(x, y) {
this.x = x;
this.y = y;
}.bind(state)
});