Skip to content

Commit 8261729

Browse files
authored
Mention numeric separators in JS guide (#40879)
1 parent ac1df5c commit 8261729

File tree

1 file changed

+15
-0
lines changed
  • files/en-us/web/javascript/guide/numbers_and_strings

1 file changed

+15
-0
lines changed

files/en-us/web/javascript/guide/numbers_and_strings/index.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,21 @@ Hexadecimal number syntax uses a leading zero followed by a lowercase or upperca
8383
1E3 // 1000
8484
```
8585

86+
### Numeric separators
87+
88+
For all literal syntaxes shown above, an underscore (`_`) can be inserted between digits to improve readability.
89+
90+
```js-nolint
91+
1_000_000_000_000
92+
1_050.95
93+
0b1010_0001_1000_0101
94+
0o2_2_5_6
95+
0xA0_B0_C0
96+
1_000_000_000_000_000_000_000n
97+
```
98+
99+
See the [lexical grammar](/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#numeric_literals) reference for more details about number literals.
100+
86101
## Number object
87102

88103
The built-in {{jsxref("Number")}} object has properties for numerical constants, such as maximum value, not-a-number, and infinity. You cannot change the values of these properties and you use them as follows:

0 commit comments

Comments
 (0)