javascript – 为什么ECMA脚本不提供任何整数类型的开箱即用?

我想知道为什么ECMA脚本不支持开箱即用的整数.当然,我知道有一些整数(在这个问题的答案中有一个很好的总结:Difference between floats and ints in Javascript?).但是这些不是“真正的”整数.而浮点数作为内容的问题相当丰富.那么为什么它不支持整数,为什么这不能用ECMA脚本6修复?
该语言是在10天内设计和实施的,所以它原本是时间限制的问题.从horses mouth

Yes, it was there from the start. But bignums were not in the cards. JS had to “look like Java” only less so, be Java’s dumb kid brother or boy-hostage sidekick. Plus, I had to be done in ten days or something worse than JS would have happened.

So double by default, int under the hood, and bitwise ops are 32-bit int (uint if you use >>>). I blame Java.

我不知道为什么它不在ES2015的桌子上.对我来说,删除样板似乎是很多工作,但我猜测. Brendan Eich在Twitter上很活跃,你可能只是问他. 🙂

翻译自:https://stackoverflow.com/questions/31780183/why-does-ecma-script-offer-no-integer-type-out-of-the-box

转载注明原文:javascript – 为什么ECMA脚本不提供任何整数类型的开箱即用?