Tweaking the code some more, the doone call works fine, the dofoo call crashes:
doone
dofoo
function x(a) { this.a = a; } var goo = new x("hello"); x.prototype.foo = function(a, b) { console.log("foo", this.a, a, b); }; setTimeout(function() { doone = goo.foo.bind(goo); doone(60, 12); }, 1000); setTimeout(function() { dofoo = goo.foo.bind(goo, 55); dofoo(10); }, 2000);
@tve started
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.
Tweaking the code some more, the
doone
call works fine, thedofoo
call crashes: