summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/api/util.md2
-rw-r--r--test/parallel/test-util-inspect.js2
2 files changed, 2 insertions, 2 deletions
diff --git a/doc/api/util.md b/doc/api/util.md
index f4f5f79f09..29ba65b760 100644
--- a/doc/api/util.md
+++ b/doc/api/util.md
@@ -556,7 +556,7 @@ const o1 = {
};
console.log(inspect(o1, { sorted: true }));
// { a: '`a` comes before `b`', b: [ 2, 3, 1 ], c: Set { 1, 2, 3 } }
-console.log(inspect(o1, { sorted: (a, b) => a < b }));
+console.log(inspect(o1, { sorted: (a, b) => b.localeCompare(a) }));
// { c: Set { 3, 2, 1 }, b: [ 2, 3, 1 ], a: '`a` comes before `b`' }
const o2 = {
diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js
index cd7d08caf0..1d37e97897 100644
--- a/test/parallel/test-util-inspect.js
+++ b/test/parallel/test-util-inspect.js
@@ -1688,7 +1688,7 @@ assert.strictEqual(
assert.strictEqual(
inspect(
{ a200: 4, a100: 1, a102: 3, a101: 2 },
- { sorted(a, b) { return a < b; } }
+ { sorted(a, b) { return b.localeCompare(a); } }
),
'{ a200: 4, a102: 3, a101: 2, a100: 1 }'
);