import scala.scalajs.js
import scala.scalajs.js.Date
import org.scalajs.dom.window.alert
val num: Double = new Date("a").getTime
alert((num + 1).toString)
This code reports NaN as the value of the alert. How do I know beforehand that num is a NaN in Scala.js code and not a proper Double?