the answer is [10, NaN, 2, 3, 4]
['10','10','10','10','10'].map(parseInt) is equal
['10','10','10','10','10'].map((item, index) => parseInt(item, index))
the answer is [10, NaN, 2, 3, 4]
['10','10','10','10','10'].map(parseInt) is equal
['10','10','10','10','10'].map((item, index) => parseInt(item, index))
For further actions, you may consider blocking this person and/or reporting abuse
GetBlockio -
Game Dev Digest - The Newsletter On Unity Game Dev -
Thanasis Traitsis -
Aditya Khare -
Top comments (2)
Hi Trudy,
Your second example
['10','10','10','10','10'].map((item, index) => parseInt(item, index))
is not quite correct.is actually equivalent to
but
parseInt
actually only expects two parameters so the third argument is ignored. This is because themap
method expects a callback with three parameters. SeeRegards, Tracy
You explained very well, more detailed and specific,thank you