Skip to content

Instantly share code, notes, and snippets.

@jepras
Created September 29, 2018 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jepras/43b8b88018e4e23c3429c39cb3f108c7 to your computer and use it in GitHub Desktop.
Save jepras/43b8b88018e4e23c3429c39cb3f108c7 to your computer and use it in GitHub Desktop.
Used charCodeAt to identify unicode point for char. In a while loop I compared the string version of the unicode alphabet with the char at the string.
function fearNotLetter(str) {
var c = 0;
var i = 0;
if (str) {
i = str.charCodeAt(0);
while (c < str.length && i < 122) {
if (String.fromCharCode(i) !== str.charAt(c)) {
return String.fromCharCode(i);
}
i++;
c++;
}
return undefined;
}
}
fearNotLetter("abce");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment