记录一个有关parseInt的题目:
A.全不是
B.[1, NaN, 0]
C.[1,NaN,NaN]
D.[1,2,3]
parseInt(string, radix) 解析一个字符串并返回指定基数的十进制整数, radix 是2-36之间的整数,表示被解析字符串的基数。
当
返回值为 NaN
将题目 ["0x1", "0x2", "0x3"].map(parseInt) 分解一下,即为:[parseInt("0x1", 0), parseInt("0x2", 1), parseInt("0x3", 2)],这里用到的点是:
牛客网原题:https://www.nowcoder.com/questionTerminal/c0ff06ee7de2422e87998a235e3455fe
参考自MDN: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/parseInt
原文:https://www.cnblogs.com/zyyaixuexi/p/15179711.html