-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Description
Bug Report
parseInt
and parseFloat
only accept string. therefore it should accept number
, Number
and bigInt
too
🔎 Search Terms
- parseInt
- parseFloat
🕗 Version & Regression Information
all versions
Please keep and fill in the line that best applies:
-->
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about parseInt and parseFloat
⏯ Playground Link
💻 Code
parseInt(854n); // Should work with bigInt
parseInt(548.25); // Should work too with numbers
parseFloat(854n); // Should work with bigInt
parseFloat(548.25); // Should work too with numbers
// Using wrappers
const n = new Number(55);
parseInt(n); // Should work
🙁 Actual behavior
Those functions accept only string to parse
🙂 Expected behavior
Should accept number
, Number
and bigInt
too
Solution
I send a PR for this. please review and merge ❤️
MartinJohns and RyanCavanaugh
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug