Playing with bind
by Joel Lubrano
JavaScript
var Foo = (function() {
function Foo() {
this.bar = 'bar';
}
var baz = function() {
console.log(this.bar);
};
Foo.prototype.blah = function() {
var b = baz.bind(this);
b();
};
return Foo;
}());
var foo = new Foo;
foo.blah();