corrected javascript list comma logic