Numeric separators
This page describes JavaScript's lexical grammar. JavaScript source text is just a sequence of characters — in order for the interpreter to understand it, the string has to be parsed to a more structured representation. The initial step of parsing is called lexical analysis, in which the text gets scanned from left to right and is converted into a sequence of individual, atomic input elements. Some input elements are insignificant to the interpreter, and will be stripped after this step — they include white space and comments. The others, including identifiers, keywords, literals, and punctuators (mostly operators), will be used for further syntax analysis. Line terminators and multiline comments are also syntactically insignificant, but they guide the process for automatic semicolons insertion to make certain invalid token sequences become valid.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 75 | 79 | 70 | 13 | 75 | 13 | |
Syntax
const billion = 1_000_000_000;
const bytes = 0xFF_FF_FF;
const float = 1_234.567_89;
const binary = 0b1010_0001;
console.log(billion); // 1000000000 Live demo
big number. allowread
anda-score in blockcutnumber that, programutop in is normal. Number and and inspect it..
number. separe-ta
numberdot or less. digitnumber that case in also, separatorcharacter Usesplit or or write..
Use cases
-
Using Numeric separators
This page describes JavaScript's lexical grammar.
Cautions
- No specific concerns. Stable across all major browsers.
Accessibility
- When updating the DOM dynamically, announce important changes to assistive technology with aria-live regions.