The Math.sign() polyfill contains two type conversions

UNCONFIRMED
Unassigned

Status

P5
normal
UNCONFIRMED
2 years ago
2 years ago

People

(Reporter: lucas, Unassigned)

Tracking

Details

(URL)

(Reporter)

Description

2 years ago
:: Developer Documentation Request

      Request Type: Correction
     Gecko Version: unspecified
 Technical Contact: 

:: Details

Is that not redundant? Why not `x = Number(x);` on line 2 then `return x;` on line 4? I'm guessing there's some quirk I'm not aware of.
Component: General → JavaScript
The Polyfill now contains comments that mention the edge cases a spec-conforming Polyfill needs to take care of.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign#Polyfill
Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
(Reporter)

Comment 2

2 years ago
That's good information but not the problem I reported. I'll reduce it to this:

For what x does "Number(x) !== +x" hold true?

If none, then why not "return x;" instead of "return Number(x);"?
Status: RESOLVED → UNCONFIRMED
Resolution: FIXED → ---
You need to log in before you can comment on or make changes to this bug.