javascript remove last character from string if comma