-
-
Save jacobmllr95/9efa5c00e77fe009aed74440992ddf50 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
const fearNotLetter = (str) => { | |
const letters = str.split(''); | |
const charCodes = letters.map((letter) => letter.charCodeAt(0)).sort((a, b) => a - b); | |
for (let i = 0; i < charCodes.length; i++) { | |
if ((charCodes[i + 1] - charCodes[i]) > 1) { | |
return String.fromCharCode(charCodes[i] + 1); | |
} | |
} | |
return undefined; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment