["1"."2"."3"].map(parseInt)
// 1, NaN, NaN[A].'1'.'2'.'3'].map((item, index) = > {
return parseInt(item, index)
})
parseInt('1'.0) / / 1
parseInt('2'.1) // NaN
parseInt('3'.2) // NaN, 3 is not binary
['10'.'10'.'10'.'10'.'10'].map(parseInt);
// [10, NaN, 2, 3, 4]
Copy the code
var new_array = arr.map(function callback(currentValue[,index[, array]]) {
// Return element for new_array
}[, thisArg])
The callback can take three arguments, the first representing the element being processed (1,2,3) and the second representing the index of that element. ` (0)
Copy the code
The parseInt() function parses a string argument and returns an integer with a specified cardinality (the basis of a mathematical system).
const intValue = parseInt(string[, radix]);
'STRING: Mandatory radix: optional. Represents the radix of the number to be parsed. The value is between 2 and 36. If this parameter is omitted or its value is 0, the number is parsed on the basis of 10. If it starts with "0x" or "0x", it will be based on 16. If this parameter is less than 2 or greater than 36, parseInt() returns NaN. `
Copy the code