JSFiddle - React, Tailwind, and code Playground
JavaScript
var t = 'aaaBBB';
var t2 = ''
var t2 = t.split('')
function foo(){
for(var i = 0; i < t2.length; i++){
if(t2[i]==t2[i].toUpperCase()){
return t2[i].toLowerCase()
}
if(t2[i]==t2[i].toLowerCase()){
return t2[i].toUpperCase()
}
}
}
console.log(foo())