Constants
Question: What types of numbers can I use in JavaScript code?
Answer: In JavaScript code, you can use the following forms of numbers:
- conventional decimal numbers:
5
137
1.3
- decimal numbers in exponential form:
6.67e-11
-1.127e20
- octal numbers, for example:
01234
-077
0312
Positive octal numbers must begin with
0
(zero)
and negative octal numbers must begin with
-0
.
- hexadecimal numbers, for example:
0xFF
-0xCCFF
0xabcdef
Positive hexadecimals must begin with
0x
and negative hexadecimals must begin with -0x
.
JavaScripter.net.
Copyright
© 1999-2006, Alexei Kourbatov