Objective
A few years ago, when SpiderMonkey implemented a rigorous model. I learned that strict mode disables the octal integer literal. Because there is evidence that some beginners will use the leading 0来 to align numbers in multiple lines, leading to unexpected results:
var sum = 015 +//equivalent to decimal 13, rather than
197 +
001; Anyway it's 1
console.log (SUM)//Added and is 211, not the novice thinks 213
But there are still a number of developers who need to octal integers (especially the Mozilla extension developers and node.js developers), most commonly when it comes to processing file permissions (755,644 of these). ES6 adds a new type of octal integer literal. Similar to hexadecimal 0x or 0X, the new octal integer uses 0o or 0O as a leading indicator, followed by several octal of numeric characters (0 to 7), which is no longer bothering the novice:
var default_perms = 0o644; Also available in strict mode
It is worth noting that the 0O prefix is too readable (0 and uppercase o are too similar to distinguish), I raised the question on Esdiscuss, hoping to disable the upper-case 0O prefix, but TC39 's current decision is that consistency should be greater than readability ( Consistency refers to being consistent with 0X and 0B. I think this decision is debatable and I recommend that you never use uppercase 0O.
In addition, some developers also need binary integer literal writing, this writing ECMAScript never supported. ES6 supports this notation, which is similar to octal and hexadecimal, using a 0b or 0 B prefix:
var flt_signbit = 0b10000000000000000000000000000000;
var flt_exponent = 0b01111111100000000000000000000000;
var Flt_mantissa = 0b00000000011111111111111111111111;
Firefox Aurora has already implemented these two syntaxes, and if you are more adventurous, you can use the newer Firefox Nightly.
Summarize
The above is the entire content of this article, I hope this article's content for everyone to learn ES6 can help. If you have questions, you can exchange messages.