summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/console.ts2
-rw-r--r--js/console_test.ts1
2 files changed, 3 insertions, 0 deletions
diff --git a/js/console.ts b/js/console.ts
index 169ff83fb..9b38e1b49 100644
--- a/js/console.ts
+++ b/js/console.ts
@@ -122,6 +122,8 @@ function stringify(
case "string":
return value;
case "number":
+ // Special handling of -0
+ return Object.is(value, -0) ? "-0" : `${value}`;
case "boolean":
case "undefined":
case "symbol":
diff --git a/js/console_test.ts b/js/console_test.ts
index 32e2c5ae2..e7cc360bc 100644
--- a/js/console_test.ts
+++ b/js/console_test.ts
@@ -100,6 +100,7 @@ test(function consoleTestStringifyCircular(): void {
const nestedObjExpected = `{ num, bool, str, method, asyncMethod, generatorMethod, un, nu, arrowFunc, extendedClass, nFunc, extendedCstr, o }`;
assertEquals(stringify(1), "1");
+ assertEquals(stringify(-0), "-0");
assertEquals(stringify(1n), "1n");
assertEquals(stringify("s"), "s");
assertEquals(stringify(false), "false");