Created
September 29, 2018 08:30
-
-
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.
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
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