1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-29 21:35:10 +00:00
serenity/Libraries/LibJS/Tests/Array.js
Andreas Kling d155491122 LibJS: Add basic Array constructor
We only support Array() with 0 or 1 parameters so far.
2020-04-04 22:28:21 +02:00

16 lines
340 B
JavaScript

function assert(x) { if (!x) throw 1; }
try {
assert(Array.length === 1);
assert(Array.prototype.length === 0);
assert(typeof Array() === "object");
assert(typeof new Array() === "object");
x = new Array(5);
assert(x.length === 5);
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e.message);
}