remove last comma from string javascript
snippet in javascript

javascript remove last character from string

user6221

const text = 'abcdef'
const editedText = text.slice(0, -1) //'abcde'

remove last comma from string javascript

user3692

str = str.replace(/,\s*$/, "");