Answers for "js reverse str case"

0

js reverse str case

//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"
Posted by: Guest on March-12-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language