/*if the string contains equal number of uppercase and lowercase letters, convert the string to lowercase.*/ function solve(s){ //.. let upperCount = 0; for(let i = 0; i < s.length; ++i){ if(s[i] != s[i].toLowerCase()){ upperCount++; if(upperCount > s.length / 2){ return s.toUpperCase(); } } } return s.toLowerCase(); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter