ladybird/Libraries/LibJS/Tests/constructor-basic.js
Andreas Kling 0593ce406b LibJS: Implement basic support for the "new" keyword
NewExpression mostly piggybacks on the existing CallExpression. The big
difference is that "new" creates a new Object and passes it as |this|
to the callee.
2020-03-28 16:33:52 +01:00

7 lines
103 B
JavaScript

function Foo() {
this.x = 123;
}
var foo = new Foo();
if (foo.x === 123)
console.log("PASS");