Eh, I agree, Python is a much better thought-out language, especially since they (after all these years) managed to pull off a backwards-compat breaking release (Py3) while JS is stuck with all of its warts forever. UTF-16, really? No integer types? sort() sorts in string order?
Yes, the ECMAScript spec says toString must be implemented in this (broken) way. This is insane, and no other sensible language does this. It is misleading and wrong. https://tc39.github.io/ecma262/#sec-tostring-applied-to-the-number-type …
-
-
Numbers are floats in Lua <5.3 too, but it never pretends floats are integers that they aren't. Smaller exact-int floats are stringified as integers, then after a threshold (lower than the 53-bit limit) it switches to exp notation. string.format will give you all the digits.pic.twitter.com/cimunNayeM
-
Ultimately this is a problem of the principle of least surprise. To any reasonable human, a string of digits with no decimal point is an *integer*. However, to JavaScript, it's a *float*. JS is abusing this point to produce unexpected results from toString.
- Show replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.