Reduce Function In Javascript Array Length Performance