Skip to content

Fix capitalization in parseInt description#32473

Merged
DanielRosenwasser merged 1 commit into
microsoft:masterfrom
jakeboone02:patch-1
Jul 19, 2019
Merged

Fix capitalization in parseInt description#32473
DanielRosenwasser merged 1 commit into
microsoft:masterfrom
jakeboone02:patch-1

Conversation

@jakeboone02
Copy link
Copy Markdown
Contributor

Fixes #32471

@DanielRosenwasser DanielRosenwasser merged commit 2aa9fb7 into microsoft:master Jul 19, 2019
Comment thread src/lib/es5.d.ts
* Converts a string to an integer.
* @param s A string to convert into a number.
* @param radix A value between 2 and 36 that specifies the base of the number in numString.
* If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.
Copy link
Copy Markdown
Contributor

@mihailik mihailik Jul 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, it says below All other strings are considered decimal. -- what???

parseInt('010')  === 8

The warning about 0-leading strings should be big and in front. The 0x quirk is rather minor in comparison, and the a/A quirk is totally insifnigicant.

BTW, there's a specific ESLint rule to warn against parseInt and potential trouble with octal format.

Copy link
Copy Markdown
Contributor

@IllusionMH IllusionMH Jul 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In all modern (and not so modern) browsers and node parseInt('010') === 10.
This change was introduced in ES5 see details on MDN

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two engines still valid in JS world, WSH and HTA, have that behaviour.

Although this file es5.d.ts may be taken to imply ES5-only types, it is also used for ES3.

@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Capitalization is incorrect in parseInt description

4 participants