I was seeing a comment from jbueno in the chat and I decided to test IE, Firefox and Chrome browsers by running this command on the consoles:
['10', '10', '10'].map(parseInt);
He returned this to me:
[10, NaN, 2]
When this would be expected:
[10, 10, 10]
But if I do this:
['10', '10', '10'].map(function(a) { return parseInt(a); });
It perfectly returns this:
[10, 10, 10]
I do not understand why this occurs, but I believe that parseInt
may work the map
array as a reference, ie in addition to return
it modifies the reference directly to each loop in addition to return
but I'm not sure.
What can it be?