📅  最后修改于: 2022-03-11 15:01:08.392000             🧑  作者: Mango
function spinWords(string){
//split("")the 5 letter word up ["h","e","l","l","o"]
let strArr=string.slice(0).split(" ");
console.log(strArr);
for(let i=0;i<=strArr.length-1;i++){
if(!strArr[i].length>=5)return strArr.join(" ");
if(strArr[i].length>=5) strArr[i]=strArr[i].split("").reverse().join("");
}
return strArr.join(" ");
}