Integers in JavaScript

后端 未结 5 2100
伪装坚强ぢ
伪装坚强ぢ 2020-12-01 11:25

I\'m a beginner to Javascript so forgive me if I sound dumb because I learned some Javascript from W3Fools (which are really difficult tutorials - they don\'t explain anythi

5条回答
  •  余生分开走
    2020-12-01 11:48

    There are really only a few data types in Javascript: Objects, numbers, and strings. As you read, JS numbers are all 64-bit floats. There are no ints.

    Firefox 4 will have support for Typed Arrays, where you can have arrays of real ints and such: https://developer.mozilla.org/en/JavaScript_typed_arrays

    Until then, there are hackish ways to store integer arrays as strings, and plucking out each integers using charCodeAt().

提交回复
热议问题