joeking
(joekinggo)
1
Not sure if this is correct but it seems like Template literals (Template strings) converts negative zero to zero.
console.log(Math.round(-0),`${-0}`,-0)
the output in the console is: -0 0(zero as a string) -0
So, `${-0}` -> 0 as a string (I think).
Hello,
Template literals are using toString
to render the expression in the resulting string.
And if you look at the spec (https://tc39.es/ecma262/#sec-numeric-types-number-tostring), it does say that -0
will be rendered as "0"