Javascript Loop Through Array With Division Of Motor