Skip to content

Instantly share code, notes, and snippets.

@jacobmllr95
Forked from emmabostian/test.js
Last active March 19, 2020 18:40
Show Gist options
  • Save jacobmllr95/9efa5c00e77fe009aed74440992ddf50 to your computer and use it in GitHub Desktop.
Save jacobmllr95/9efa5c00e77fe009aed74440992ddf50 to your computer and use it in GitHub Desktop.
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