统计每个字母出现的次数
const countSort = (string) => {
const strArr = string.split('')
const map = {}
for(let value of strArr){
if(value in map){
map[value] += 1
}else if(value !== ' '){
map[value] = 1
}
}
return map
}
var string = 'i amasd sdf'
console.log(countSort(string))