Integers in JavaScript

Posted by muntoo on Stack Overflow See other posts from Stack Overflow or by muntoo
Published on 2011-01-16T04:05:06Z Indexed on 2011/01/16 4:53 UTC
Read the original article Hit count: 237

Filed under:
|
|

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 anything I want to know, but everything I probably can guess from my experience with C++).

I may be switching over to MDN, but if you can recommend any other tutorials, that be great.

Anyways, so here's my question:

I just read a few lines of this, and apparently:

Numbers in JavaScript are "double-precision 64-bit format IEEE 754 values", according to the spec. This has some interesting consequences. There's no such thing as an integer in JavaScript, so you have to be a little careful with your arithmetic if you're used to math in C or Java.

I've already seen that there are few of the data types (for variables) I'm used to from C++. But I didn't expect all numbers to automatically be floats. Isn't there any way to use integers, not float? Will a future version of JavaScript support ints?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about float