Just to add that this is pretty much standard JS. For example:
function Foo(x) { this.baz = x; }
Foo.prototype.bar = function() { return this.baz; };
var f = new Foo("Hello World");
console.log(f.bar()); // prints "Hello World"
function printer(fn) { console.log(fn()); }
printer(f.bar); // prints 'undefined'
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Just to add that this is pretty much standard JS. For example: