mirror of
https://github.com/tc39/test262.git
synced 2025-04-08 19:35:28 +02:00
20 lines
407 B
JavaScript
20 lines
407 B
JavaScript
function shouldBe(actual, expected) {
|
|
if (actual !== expected)
|
|
throw new Error('bad value: ' + actual);
|
|
}
|
|
|
|
|
|
{
|
|
let array = [42, , , 0];
|
|
shouldBe(array.indexOf(Number.NaN), -1);
|
|
shouldBe(array.indexOf(0), 3);
|
|
}
|
|
{
|
|
let array = [42.195, , , 0];
|
|
shouldBe(array.indexOf(Number.NaN), -1);
|
|
}
|
|
{
|
|
let array = [42.195, Number.NaN, , 0];
|
|
shouldBe(array.indexOf(Number.NaN), -1);
|
|
}
|