Hello, `print(0.0.toString())` prints `0.0` on the...
# javascript
l
Hello,
print(0.0.toString())
prints
0.0
on the JVM, but
0
on JS. Is there an alternative to
toString()
to get
0.0
on JS as well?
e
doesn't seem like there is
I suppose you could do a hack like like
Copy code
fun Double.toStringInFloatingPointNotation(): String {
    val string = toString()
    return if ('.' in string || 'e' in string || !isFinite()) string else "$string.0"
}