function sortString(str) { const sort = str.split('').sort().join(); return sort.replace(/\$|,/g, ''); } console.log(sortString('Grepper'));