blob: 1a089c9e3439d024671fb5db4d2c62f090aead9a [file] [log] [blame]
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
{
let array = [42.195, -0.0, -Infinity];
shouldBe(array.indexOf(Infinity), -1);
shouldBe(array.indexOf(-Infinity), 2);
shouldBe(array.indexOf(42), -1);
}
{
let array = [1, 2, 3, 0];
shouldBe(array.indexOf(Infinity), -1);
shouldBe(array.indexOf(-Infinity), -1);
}
{
let array = ["String", 42.5, Infinity, 33];
shouldBe(array.indexOf(Infinity), 2);
shouldBe(array.indexOf(-Infinity), -1);
}