2 ms·
TL;DR, parseInt() takes the number base as a second argument, and map() passes three arguments (value, index, whole array). Using directly like this a function
by seszett 7y ago
TL;DR, parseInt() takes the number base as a second argument, and map() passes three arguments (value, index, whole array).
Using directly like this a function with map() is just incorrect, the correct way to do it is:
['1', '7', '11'].map(x => parseInt(x))
edit I'm getting downvoted, it doesn't matter much but I don't understand it when the most upvoted comment seems to say more or less the same?
- deleted 7y ago[deleted]