Optimize/Cleanup

No idea what performance increase this will give, there will be one for creation though. There are also optimizations throughout that will give slight speed increases and protect against falsey compares.
I don't see why this is a must. The solution as it was is clear and it won't affect performance. especially here, a one-shot function defining a property won't matter. The style guide also says nothing about having function declarations inside or outside of the loop, and imo inside is much clearer about what happens.