//字符串的去重排序 const s1 = 'bacha'; const s2 = 'bbaaccedfg' function uniqueStr(arr){ const s1Arr = arr.split(''); const uniqueArr = [...new Set(s1Arr)]; return uniqueArr.sort().toString().replace(/,/g,''); } console.log(uniqueStr(s1)); console.log(uniqueStr(s2));