I'm curious if the performance improvement is really because of leaving away the recursion.
forEach() is known to be slower than a basic while loop, so this could be the reason. JS does not (yet) have tail optimization baked in, but i doubt it makes any difference with an array so small like in the example.