We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
原文:Advanced-Frontend/Daily-Interview-Question#4
parseInt(string, radix)接收两个参数,第一个表示被处理的值(字符串),第二个表示为解析时的基数。
string要被解析的值。如果参数不是一个字符串,则将其转换为字符串(使用 ToString 抽象操作)。字符串开头的空白符将会被忽略。
radix 可选从 2 到 36,表示字符串的基数。例如指定 16 表示被解析值是十六进制数。请注意,10不是默认值!
返回NaN情况:
MDN中有详细解释:
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/parseInt
Map的MDN: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/map
['1', '1', '3'].map(parseInt) ['1', '0', '3'].map(parseInt) ['1', 1, '3'].map(parseInt) 答案都是: [1, NaN, NaN] parseInt('2', 1) parseInt('1', 1) 这俩都是 NaN
The text was updated successfully, but these errors were encountered:
No branches or pull requests
原文:Advanced-Frontend/Daily-Interview-Question#4
parseInt(string, radix)接收两个参数,第一个表示被处理的值(字符串),第二个表示为解析时的基数。
返回NaN情况:
MDN中有详细解释:
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/parseInt
Map的MDN:
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/map
The text was updated successfully, but these errors were encountered: