📅  最后修改于: 2022-03-11 15:02:47.259000             🧑  作者: Mango
// Reverse the Odd Length Words
function reverseOdd(str) {
return str.split(" ").map(w => w.length%2 ? [...w].reverse().join("") : w).join(" ");
}
console.log(reverseOdd("Bananas")); // "sananaB"
console.log(reverseOdd("One two three four")); // "enO owt eerht four"