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.

PR-URL: #49717
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
deokjinkim authored and ruyadorno committed Sep 28, 2023
1 parent 843df1a commit 4175ea3
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 4175ea3

Please sign in to comment.