📅  最后修改于: 2022-03-11 15:02:08.130000             🧑  作者: Mango
//Reverse the Case
function reverseCase(str) {
return str.replace(/./g, c => c === c.toUpperCase() ? c.toLowerCase() : c.toUpperCase());
}
console.log(reverseCase("Happy Birthday")); // "hAPPY bIRTHDAY"
console.log(reverseCase("MANY THANKS")); // "many thanks"
console.log(reverseCase("sPoNtAnEoUs")); // "SpOnTaNeOuS"