# Missing Letters challenge completed!

Missing Letters challenge completed!
0

#1

`Hey does anyone think this solution is too complicated?
The concept is that if the letters are in sequence?The utf value should also be in sequence from low to high.
Subtracting the utf-16 value of each letter in front should leave over 1 if the letters are in sequence.
Otherwise failing this test will identify the utf value of the letter that is missing.

``````function fearNotLetter(str) {

var first=str.charCodeAt(0);  //should equal lets say 65
var string_length = str.length;
var first_element = str.charCodeAt(0);
var missing_letter;
var missing_letter_string;

for(var i=1;i<string_length;i++){

if(str.charCodeAt(i)-first_element!==1){
console.log(str.charCodeAt(i),first_element);
missing_letter = str.charCodeAt(i)-1;
missing_letter_string = String.fromCharCode(missing_letter);

break;
}
else
first_element++;

}

return missing_letter_string;
}

fearNotLetter("abce");

``````

#2

I blurred out your complete solution so as not to spoil it for others who may have found your topic while still working on their own solution.

Your solution has a few extra variables and could be simplified a bit, but I think it is good for a first try.

My first solution is below for comparison.

``````function fearNotLetter(str) {
for (var i=0; i<str.length; i++) {
var currLetterCode = str.charCodeAt(i);
var nextLetterCode = str.charCodeAt(i+1);
if (nextLetterCode - currLetterCode > 1) {
return String.fromCharCode(currLetterCode+1);
}
}
}
``````