题解:
function solution(str1, str2) {
const set1 = new Set([...str1]);
const set2 = new Set([...str2]);
return [...set1].filter((item) => set2.has(item)).sort();
}
console.log(solution("fach", "bbaaccedfg"));
//输入:fach
// bbaaccedfg
//输出 acf