SOURCE

var str = "aabb"
var arr = str.split("");
arr.sort(function(a,b) {return a.charCodeAt()-b.charCodeAt();})
console.log(arr)
const newArr = [...new Set(arr)]
console.log(newArr)
console.log(arr.length - newArr.length)
console 命令行工具 X clear

                    
>
console