Hapus koma terakhir dari string javascript
str = str.replace(/,\s*$/, "");
Ugly Unicorn
str = str.replace(/,\s*$/, "");
const text = 'abcdef'
const editedText = text.slice(0, -1) //'abcde'