mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:57:45 +00:00
LibJS: Add Array.prototype.includes
This commit is contained in:
parent
a639172760
commit
687096cadd
3 changed files with 56 additions and 0 deletions
20
Libraries/LibJS/Tests/Array.prototype.includes.js
Normal file
20
Libraries/LibJS/Tests/Array.prototype.includes.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
load("test-common.js");
|
||||
|
||||
try {
|
||||
assert(Array.prototype.includes.length === 1);
|
||||
|
||||
var array = ['hello', 'friends', 1, 2, false];
|
||||
|
||||
assert(array.includes('hello') === true);
|
||||
assert(array.includes(1) === true);
|
||||
assert(array.includes(1, -3) === true);
|
||||
assert(array.includes('serenity') === false);
|
||||
assert(array.includes(false, -1) === true);
|
||||
assert(array.includes(2, -1) === false);
|
||||
assert(array.includes(2, -100) === true);
|
||||
assert(array.includes('friends', 100) === false);
|
||||
|
||||
console.log("PASS");
|
||||
} catch (e) {
|
||||
console.log("FAIL: " + e);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue