Why check for !isNaN() after isFinite()?

后端 未结 5 926
你的背包
你的背包 2021-02-01 17:04

I came across the goog.math.isFiniteNumber function in the Google Closure Library. What it does is checking whether a given number is both finite and not NaN<

5条回答
  •  醉话见心
    2021-02-01 17:46

    If isFinite worked the way isFiniteNumber did, then there would be no reason to write isFiniteNumber. There's probably some browser out there somewhere that treats NaN as finite.

提交回复
热议问题