if (result == Number.POSITIVE_INFINITY || result == Number.NEGATIVE_INFINITY)
{
// ...
}
You could possibly use the isFinite
function instead, depending on how you want to treat NaN
. isFinite
returns false
if your number is POSITIVE_INFINITY
, NEGATIVE_INFINITY
or NaN
.
if (isFinite(result))
{
// ...
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…