Fix capitalization in parseInt description#32473
Merged
Merged
Conversation
mihailik
reviewed
Jul 19, 2019
| * 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. |
Contributor
There was a problem hiding this comment.
Wait, it says below All other strings are considered decimal. -- what???
parseInt('010') === 8The 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.
Contributor
There was a problem hiding this comment.
In all modern (and not so modern) browsers and node parseInt('010') === 10.
This change was introduced in ES5 see details on MDN
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #32471