mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:07:35 +00:00
LibJS: Add Array.prototype.join()
And share the code with Array.prototype.toString() :^)
This commit is contained in:
parent
fa30355194
commit
ad2aac5fde
3 changed files with 41 additions and 8 deletions
13
Libraries/LibJS/Tests/Array.prototype.join.js
Normal file
13
Libraries/LibJS/Tests/Array.prototype.join.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
load("test-common.js");
|
||||
|
||||
try {
|
||||
assert(Array.prototype.push.length === 1);
|
||||
|
||||
assert(["hello", "friends"].join() === "hello,friends");
|
||||
assert(["hello", "friends"].join(" ") === "hello friends");
|
||||
assert(Array(3).join() === ",,");
|
||||
|
||||
console.log("PASS");
|
||||
} catch (e) {
|
||||
console.log("FAIL: " + e);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue