How i can convert my upper case, lower case , sentence case into toggle case by using the javascript function? Can any body elaborate how it can be done?
Can you see if this function helps your case
function toggleCase(str) {
return str.toUpperCase().split(' ').map(function(word) {
return (word.charAt(0).toLowerCase() + word.slice(1));
}).join(' ');
}
toggleCase("this sentence is in lower case which is to be converted to toggle case");
Output : "tHIS sENTENCE iS iN lOWER cASE wHICH iS tO bE cONVERTED tO tOGGLE cASE"