JSFiddle - React, Tailwind, and code Playground

by evild70

JavaScript

let str = 'abc,def,ghi, ';
let str2 = str.replace(/,(?=\s*$)/, '');
console.log(str2");