Skip to content

Commit

Permalink
doc: add missed inspect with numericSeparator to example
Browse files Browse the repository at this point in the history
In exmple of `util.inspect` with numericSeparator option,
calling `util.inspect` is missed. So actual result is different
from expected result.
  • Loading branch information
deokjinkim committed Sep 19, 2023
1 parent cd97e28 commit 785ce8a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -777,8 +777,14 @@ const million = 1_000_000;
const bigNumber = 123_456_789n;
const bigDecimal = 1_234.123_45;

console.log(thousand, million, bigNumber, bigDecimal);
// 1_000 1_000_000 123_456_789n 1_234.123_45
console.log(inspect(thousand, { numericSeparator: true }));
// 1_000
console.log(inspect(million, { numericSeparator: true }));
// 1_000_000
console.log(inspect(bigNumber, { numericSeparator: true }));
// 123_456_789n
console.log(inspect(bigDecimal, { numericSeparator: true }));
// 1_234.123_45
```

`util.inspect()` is a synchronous method intended for debugging. Its maximum
Expand Down

0 comments on commit 785ce8a

Please sign in to comment.