Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为什么会这样,求大佬科普 #3

Closed
EstherHuo opened this issue Jan 22, 2019 · 2 comments
Closed

为什么会这样,求大佬科普 #3

EstherHuo opened this issue Jan 22, 2019 · 2 comments

Comments

@EstherHuo
Copy link

image

@machangzhi
Copy link

parseInt(string, radix)
string | 必需。要被解析的字符串。
radix | 可选。表示要解析的数字的基数。该值介于 2 ~ 36 之间。如果省略该参数或其值为 0,则数字将以 10 为基础来解析。如果它以 “0x” 或 “0X” 开头,将以 16 为基数。如果该参数小于 2 或者大于 36,则 parseInt() 将返回 NaN。
parseFloat(string)
string | 必需。要被解析的字符串。

@Aiyoweioo
Copy link

['1', '2','3'].map(parseInt) 等价于 parseInt('1',0) = 1, parseInt('2',1) = NaN, parseInt('3',2) = NaN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants