| Tests for Array.prototype.includes |
| |
| On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". |
| |
| |
| PASS Array.prototype.includes.length is 1 |
| PASS Array.prototype.includes.name is 'includes' |
| PASS [1, 2, 3].includes(2) is true |
| PASS [1, 2, 3].includes(4) is false |
| PASS [].includes(1) is false |
| PASS [1, 2, 3].includes(1, 2) is false |
| PASS [1, 2, 3].includes(3, 3) is false |
| PASS [1, 2, 3].includes(2, undefined) is true |
| PASS [1, 2, 3].includes(2, null) is true |
| PASS [1, 2, 3].includes(2, 1, 2) is true |
| PASS [1, 2, 3].includes(2, Number) is true |
| PASS [1, 2, 3].includes(2, Number(2)) is false |
| PASS [1, 2, 3].includes(2, 'egg') is true |
| PASS [1, 2, 3].includes(2, '3') is false |
| PASS [1, 2, 3].includes(3, -1) is true |
| PASS [1, 2, 3].includes(1, -2) is false |
| PASS [1, 2, 3].includes(1, -3) is true |
| PASS [1, 2, NaN, 4].includes(NaN) is true |
| PASS ['egg', 'bacon', 'sausage'].includes('egg') is true |
| PASS ['egg', 'bacon', 'sausage'].includes('spinach') is false |
| Array with holes (sparse array) |
| PASS a.includes('egg') is true |
| PASS a.includes('sausage') is true |
| PASS a.includes('hashbrown') is false |
| PASS a.includes('toast') is false |
| PASS Array.prototype.includes.call(undefined, 1) threw exception TypeError: Array.prototype.includes requires that |this| not be undefined. |
| PASS Array.prototype.includes.call(null, 1) threw exception TypeError: Array.prototype.includes requires that |this| not be null. |
| Array-like object with invalid lengths |
| PASS var obj = { 0: 1, 1: 1, 2: 1, length: 0 }; Array.prototype.includes.call(obj, 1) is false |
| PASS var obj = { 0: 1, 1: 1, 2: 1, length: -0 }; Array.prototype.includes.call(obj, 1) is false |
| PASS var obj = { 0: 1, 1: 1, 2: 1, length: -3 }; Array.prototype.includes.call(obj, 1) is false |
| PASS successfullyParsed is true |
| |
| TEST COMPLETE |
| |