How to write a number with numeric separators in JavaScript

1 Answer

0 votes
const million = 1_000_000; 
console.log(million);

const n = 1_000_00.01_07_3_09;
console.log(n);

const octal= 0o22_31;
console.log(octal);

const hex = 0xfa_32_b0;
console.log(hex);

const binary = 0b1110_1001_1111;
console.log(binary);
   
   
 
   
/*
run:
   
1000000
100000.0107309
1177
16396976
3743
   
*/

 



answered Dec 12, 2021 by avibootz
...