JavaScript: The Definitive Guide, Sixth Editio javaScript权威指南(第6版) pdf 文字版-文字版, javascript电子书, 和javascript 有关的电子书:

3.1.1 Integer Literals

In a JavaScript program, a base-10 integer is written as a sequence of digits. For
In addition to base-10 integer literals, JavaScript recognizes hexadecimal (base-16) val-
ues. A hexadecimal literal begins with “0x” or “0X”, followed by a string of hexadecimal
digits. A hexadecimal digit is one of the digits 0 through 9 or the letters a (or A) through
f (or F), which represent values 10 through 15. Here are examples of hexadecimal in-
teger literals:
0xff  // 15*16 + 15 = 255 (base 10)
Although the ECMAScript standard does not support them, some implementations of
JavaScript allow you to specify integer literals in octal (base-8) format. An octal literal
begins with the digit 0 and is followed by a sequence of digits, each between 0 and 7.
For example:
0377  // 3*64 + 7*8 + 7 = 255 (base 10)
Since some implementations support octal literals and some do not, you should never
write an integer literal with a leading zero; you cannot know in this case whether an
implementation will interpret it as an octal or decimal value. In the strict mode of
ECMAScript 5 (§5.7.3), octal literals are explicitly forbidden.
友情链接It题库(| 版权归yishouce.com所有| 友链等可联系|粤ICP备16001685号-1