How To Use Array Reduce In Javascript