how can I check if the result to call a JavaScript function is undefined?
I tried with
if( s.getNode(id1) != js.undefined)
but fastOptJS say:
scala.scalajs.js.Dynamic and scala.scalajs.js.UndefOr[Nothing] are unrelated: they will most likely always compare unequal
TIA
This is Scala's type system being a bit "too" helpful.
To compare against undefined
, you can use js.isUndefined
:
if (!js.isUndefined(s.getNode(id1)))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With