Except that it doesn’t work like map in all situations. For example, try running the array [1,,2]
through your function and the built-in Array#map, with a function such as x => x === undefined
. Your code does not handle holes properly, which is actually quite an important aspect of map
's behavior.