Espruino/tests/test_context2.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

14 lines
321 B
JavaScript

// See https://github.com/espruino/Espruino/issues/109
var r1 = 1;
var r2 = 2;
var a = { hi : "Hello",
p1 : function() { r1 = this.hi; },
p2 : function() { r2 = this.hi; } };
setTimeout(function() { a.p1(); }, 10);
setTimeout(a.p2, 20);
setTimeout(function() {
result = r1 == "Hello" && r2 === undefined;
}, 50);