['1','2','3'].map(parseInt)
Run Code Online (Sandbox Code Playgroud)
返回 [1, NaN, NaN]
我不知道为什么?在我看来是这样的:
['1','2','3'].map(function(i){return parseInt(i,10)})
Run Code Online (Sandbox Code Playgroud)
返回 [1, 2, 3]
================================================== ====
和其他
['1','2','3'].map(parseFloat)
回报[1, 2, 3]
javascript ×1