1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:17:44 +00:00

LibJS: Fix Array.prototype.lastIndexOf() implementation

This commit is contained in:
Linus Groh 2020-05-22 18:21:33 +01:00 committed by Andreas Kling
parent 6a4280e6e5
commit 843e000f18
2 changed files with 8 additions and 10 deletions

View file

@ -6,11 +6,12 @@ try {
var array = [1, 2, 3, 1, "hello"];
assert(array.lastIndexOf("hello") === 4);
assert(array.lastIndexOf("hello", 1000) === 4);
assert(array.lastIndexOf(1) === 3);
assert(array.lastIndexOf(1, -1) === -1);
assert(array.lastIndexOf(1, -1) === 3);
assert(array.lastIndexOf(1, -2) === 3);
assert(array.lastIndexOf(2) === 1);
assert(array.lastIndexOf(2, -3) === -1);
assert(array.lastIndexOf(2, -3) === 1);
assert(array.lastIndexOf(2, -4) === 1);
assert([].lastIndexOf('hello') === -1);
assert([].lastIndexOf('hello', 10) === -1);