Reduce Function In Javascript Array Of Integers In C