Skip to content

Instantly share code, notes, and snippets.

@alexandrebvd
Created August 14, 2015 16:13
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 alexandrebvd/0e781f8469f5b97a8f0b to your computer and use it in GitHub Desktop.
Save alexandrebvd/0e781f8469f5b97a8f0b to your computer and use it in GitHub Desktop.
25.Bonfire: Missing letters
function fearNotLetter(str) {
var missing = '';
var isMissing = false;
for (var i = 0; i < str.length-1; i++) {
if (str.charCodeAt(i+1) - str.charCodeAt(i) !== 1 && !isMissing) {
missing = String.fromCharCode(str.charCodeAt(i)+1);
isMissing = true;
} else if (!isMissing) {
missing = undefined;
}
console.log(missing);
}
return missing;
}
fearNotLetter('bcd');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment