Espruino/tests/test_object_method_callback_002.js
Gordon Williams 386599fe75 Remove JSV_PARENTINFO, as it turns out JS doesn't keep track of function scopes anyway (fix #109)
Make 'this' a keyword (now faster, more memory efficient)
            Make 'Hardware' (root) the default value of 'this'
2013-12-03 17:39:02 +00:00

16 lines
298 B
JavaScript

function A() {
}
A.prototype.b = function() { return this.num; };
var a = new A();
a.num = 42;
function runCallback(cb) { return cb(); }
cb = a.b;
var res = runCallback(a.b);
// This is really the case, as the execution scope is not preserved in JS
result = res===undefined;
console.log(res);