ladybird/Libraries/LibJS/Tests/function-this-in-arguments.js
Linus Groh c06a6c67d5 LibJS: Add globalThis
We already have "global" as a way to access the global object in js(1)
(both REPL and script mode). This replaces it with "globalThis", which
is available in all environments, not just js.
2020-04-09 15:58:49 +02:00

15 lines
263 B
JavaScript

try {
assert(typeof this === "object");
assert(this === globalThis);
function Foo() {
this.x = 5;
assert(typeof this === "object");
assert(this.x === 5);
}
new Foo();
console.log("PASS");
} catch (err) {
console.log("FAIL: " + err);
}