mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
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.
15 lines
263 B
JavaScript
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);
|
|
}
|