OLOO

by Artem

JavaScript

'use strict';

var Foo = {
  init: function(who) {
    this.me = who;
  },
  identify: function() {
    console.log(this.me);
  }
};

var Bar = Object.create(Foo);
Bar.speak = function() {
  console.log('called speak');
  this.identify();
};

var b1 = Object.create(Bar);
b1.init('b1');
b1.speak();