mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:57:35 +00:00
LibJS: Make Array.prototype.includes() generic
This commit is contained in:
parent
e78bc2f6fd
commit
92fd140cb2
2 changed files with 21 additions and 16 deletions
|
@ -62,6 +62,14 @@ try {
|
|||
assert(Array.prototype.lastIndexOf.call({ length: 5, 2: "foo", 4: "foo" }, "foo", -2) === 2);
|
||||
}
|
||||
|
||||
{
|
||||
assert(Array.prototype.includes.call({}) === false);
|
||||
assert(Array.prototype.includes.call({ 0: undefined }) === false);
|
||||
assert(Array.prototype.includes.call({ length: 1, 0: undefined }) === true);
|
||||
assert(Array.prototype.includes.call({ length: 1, 2: "foo" }, "foo") === false);
|
||||
assert(Array.prototype.includes.call({ length: 5, 2: "foo" }, "foo") === true);
|
||||
}
|
||||
|
||||
const o = { length: 5, 0: "foo", 1: "bar", 3: "baz" };
|
||||
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue