Closed Bug 1325251 Opened 7 years ago Closed 4 years ago

The Math.sign() polyfill contains two type conversions

Categories

(Developer Documentation Graveyard :: JavaScript, defect, P5)

All
Other
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: lucas, Unassigned)

References

()

Details

:: 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
Closed: 7 years ago
Resolution: --- → FIXED
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 → ---
MDN Web Docs' bug reporting has now moved to GitHub. From now on, please file content bugs at https://github.com/mdn/sprints/issues/ and platform bugs at https://github.com/mdn/kuma/issues/.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago4 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.