File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -610,7 +610,8 @@ changes:
610
610
This might cause side effects depending on the getter function.
611
611
** Default:** ` false ` .
612
612
* ` numericSeparator ` {boolean} If set to ` true ` , an underscore is used to
613
- separate thousands in all bigints and numbers. ** Default:** ` false ` .
613
+ separate every three digits in all bigints and numbers.
614
+ ** Default:** ` false ` .
614
615
* Returns: {string} The representation of ` object ` .
615
616
616
617
The ` util.inspect() ` method returns a string representation of ` object ` that is
@@ -759,6 +760,21 @@ assert.strict.equal(
759
760
);
760
761
```
761
762
763
+ The ` numericSeparator ` option adds an underscore every three digits to all
764
+ numbers.
765
+
766
+ ``` js
767
+ const { inspect } = require (' util' );
768
+
769
+ const thousand = 1_000 ;
770
+ const million = 1_000_000 ;
771
+ const bigNumber = 123_456_789n ;
772
+ const bigDecimal = 1_234.123_45
773
+
774
+ console .log (thousand, million, bigNumber, bigDecimal);
775
+ // 1_000 1_000_000 123_456_789n 1_234.123_45
776
+ ```
777
+
762
778
` util.inspect() ` is a synchronous method intended for debugging. Its maximum
763
779
output length is approximately 128 MB. Inputs that result in longer output will
764
780
be truncated.
You can’t perform that action at this time.
0 commit comments