ladybird/Libraries/LibJS/Tests/constructor-basic.js
Jack Karamanian 949bffdc93 LibJS: Define the "constructor" property on ScriptFunction's prototype
and set it to the current function
2020-06-29 17:54:54 +02:00

17 lines
273 B
JavaScript

load("test-common.js");
try {
function Foo() {
this.x = 123;
}
assert(Foo.prototype.constructor === Foo);
var foo = new Foo();
assert(foo.constructor === Foo);
assert(foo.x === 123);
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);
}