mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 02:38:13 +00:00
LibJS: Add "constructor" property to constructor prototypes
This commit is contained in:
parent
39855fe9ef
commit
f07f8d5a44
8 changed files with 98 additions and 10 deletions
28
Libraries/LibJS/Tests/Object.prototype.constructor.js
Normal file
28
Libraries/LibJS/Tests/Object.prototype.constructor.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
try {
|
||||
assert(Array.prototype.constructor === Array)
|
||||
assert(Boolean.prototype.constructor === Boolean)
|
||||
assert(Date.prototype.constructor === Date)
|
||||
assert(Error.prototype.constructor === Error)
|
||||
assert(Function.prototype.constructor === Function)
|
||||
assert(Number.prototype.constructor === Number)
|
||||
assert(Object.prototype.constructor === Object)
|
||||
|
||||
o = {}
|
||||
assert(o.constructor === Object)
|
||||
|
||||
o = new Object
|
||||
assert(o.constructor === Object)
|
||||
|
||||
a = []
|
||||
assert(a.constructor === Array)
|
||||
|
||||
a = new Array
|
||||
assert(a.constructor === Array)
|
||||
|
||||
n = new Number(3)
|
||||
assert(n.constructor === Number)
|
||||
|
||||
console.log("PASS");
|
||||
} catch (e) {
|
||||
console.log("FAIL: " + e);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue