This works as expected. We found that this doesn't work if toMakeOption is of type Long (which was what we were doing), so I've tested this for Int, Long and Double values as below:
val toMakeOption: Long = System.nanoTime() - startForOption
println(f"created new, took [$toMakeOption%,d]ns")
val w = 1234567890.asInstanceOf[js.Object].toLocaleString()
println(s"w[Int] = $w")
val x = toMakeOption.asInstanceOf[js.Object].toLocaleString()
println(s"x[Long] = $x")
val y = toMakeOption.toInt.asInstanceOf[js.Object].toLocaleString()
println(s"y[Int] = $y")
val z = toMakeOption.toDouble.asInstanceOf[js.Object].toLocaleString()
println(s"z[Double] = $z")
and we got the following output in JavaScript console:
created new, took [22799000]ns
w[Int] = 1,234,567,890
x[Long] = 22799000
y[Int] = 22,799,000
z[Double] = 22,799,000
Why doesn't it work for longs do you think?
Thanks