Since the value either exists or is undefined,
donkey.fur_pos.map(i => i ? i : undefined)
can be simplified to:
donkey.fur_pos.map(i => i)
It's inaccurate though to say that the undefined will be removed - in what way are you using it for which this is the case?
What you can do however is eg:
.map(i => i)
which will remove all falsey statements including undefined and null, but also 0 and false, so you may want a more robust filter function, depending on your objective.
+1 .filter(Boolean) is very elegant solution 😎
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.