//总体想法是讲字符串拆分成数组再次循环调用charCodeAt函数-96相加
//再次遍历数组 找寻最大数的下标 return 拆分数组的字符
function high(arr) {
var splis = arr.split(" ")
var result =[]
var rr = 0;
for(item of splis){
let arrs = 0
for (let index = 0; index < item.length; index++) {
arrs += item.charAt(index).charCodeAt()-96
}
result.push(arrs)
}
var linm =0
result.forEach((value,index)=>{
if(linm < value){
linm = value
rr = index}
})
return splis[rr]
}
ktta的最优解
function high(s){
let as = s.split(' ').map(s=>[...s].reduce((a,b)=>a+b.charCodeAt(0)-96,0));
return s.split(' ')[as.indexOf(Math.max(...as))];
}