function-this-in-arguments.js 263 B

123456789101112131415
  1. try {
  2. assert(typeof this === "object");
  3. assert(this === globalThis);
  4. function Foo() {
  5. this.x = 5;
  6. assert(typeof this === "object");
  7. assert(this.x === 5);
  8. }
  9. new Foo();
  10. console.log("PASS");
  11. } catch (err) {
  12. console.log("FAIL: " + err);
  13. }