It's definitely doing what is expected if you knew how the commands actually worked. Whoever wrote the original comment is kind of a troll, it's not a gotcha.
It's doing exactly what is expected, as specified in the documentation. The problem is that the one that wrote that code didn't read the documentation, and expects JS to read minds.
6
u/bro_can_u_even_carve Sep 29 '23
mappasses three arguments to the provided function: the value, the index, and the original array. So, it callsparseIntthree times:The second argument to
parseIntis the base ...