Are there any differences with casting in Kotlin J...
# javascript
n
Are there any differences with casting in Kotlin JS compared to Kotlin JVM?
d
Numbers are all erased to one type (except
Long
), so
val a: Int = 3; val b = a as Float
will not throw an exception. Arrays are represented as JavaScript arrays, so they are not typed, like on the JVM:
val a: Array<String> = emptyArray(); val b = a as Array<Int>
will not throw an exception (I think, I have not tried this one). I think that's basically it.