Javascript Loop Through Object Array To Int