Created
August 10, 2020 17:15
-
-
Save alimertcakar/07bcdc7df277b39c41a0bc556f470419 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let str = "aAbBcCddDfgGFj"; | |
function isUpperCase(c){ | |
return c === c.toUpperCase(); | |
} | |
let strArr = str.split(""); | |
console.log(strArr) | |
let answer = ""; | |
let strSet = new Set(); | |
for(let i = 0; i<strArr.length;i++){ | |
if(isUpperCase(strArr[i])){ | |
if(str.includes(strArr[i].toLowerCase())) { | |
strSet.add(strArr[i].toUpperCase()) | |
} | |
} else { | |
if(str.includes(strArr[i].toUpperCase())) { | |
strSet.add(strArr[i].toUpperCase()) | |
} | |
} | |
} | |
let strSetArr = [...strSet] | |
strSetArr.sort((a,b)=>a.localeCompare(b)) | |
alert(strSetArr[strSetArr.length-1]) | |
console.log(answer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment