mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Make 'this' a keyword (now faster, more memory efficient)
Make 'Hardware' (root) the default value of 'this'
16 lines
298 B
JavaScript
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);
|
|
|