DEV Community

Discussion on: Numeric Separators in JavaScript

Collapse
 
lionelrowe profile image
lionel-rowe • Edited

Usually you'd use them where you'd use commas, dots, or spaces, depending on region, in prose. So every 3 decimal digits in the thousand/million/billion convention (10_000_000), or every 2-3 in the thousand/crore/lakh convention (1_00_00_000).

For hex, delimiting every 2 digits splits neatly into bytes (0xff_00_ff), or for binary you could split into groups of 4 to give "nibbles" - half a byte, equivalent to 1 hex digit each (0b1010_1010).