Files
ladybird/Tests/LibJS/Runtime/functions/function-this-in-arguments.js
2026-01-22 07:46:48 -05:00

17 lines
387 B
JavaScript

test("basic functionality", () => {
expect(typeof this).toBe("object");
expect(this).toBe(globalThis);
});
test("this inside instantiated functions is not globalThis", () => {
let functionThis;
function Foo() {
this.x = 5;
functionThis = this;
}
new Foo();
expect(typeof functionThis).toBe("object");
expect(functionThis.x).toBe(5);
});