Did you try this on desktop JavaScript? I just did with jsbin and it behaves exactly the same way in your first example.
I think your problem is that you're not using bind correctly. bind returns a bound function, but doesn't alter the one you pass as an argument.
bind
So:
a.bind(b); // does nothing a = a.bind(b); // does what you want
@Gordon 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.
Did you try this on desktop JavaScript? I just did with jsbin and it behaves exactly the same way in your first example.
I think your problem is that you're not using
bind
correctly.bind
returns a bound function, but doesn't alter the one you pass as an argument.So: