curriculum/challenges/english/blocks/lab-missing-letter-detector/af7588ade1100bde429baf20.md
Objective: Fulfill the user stories below and get all the tests to pass to complete the lab.
User Stories:
fearNotLetter.fearNotLetter function should accept one argument: a string representing a range of letters in alphabetical order which can have one letter missing.undefined.You should have a fearNotLetter function.
assert.isFunction(fearNotLetter);
fearNotLetter("abce") should return the string d.
assert.deepEqual(fearNotLetter('abce'), 'd');
fearNotLetter("abcdefghjklmno") should return the string i.
assert.deepEqual(fearNotLetter('abcdefghjklmno'), 'i');
fearNotLetter("stvwx") should return the string u.
assert.deepEqual(fearNotLetter('stvwx'), 'u');
fearNotLetter("bcdf") should return the string e.
assert.deepEqual(fearNotLetter('bcdf'), 'e');
fearNotLetter("abcdefghijklmnopqrstuvwxyz") should return undefined.
assert.isUndefined(fearNotLetter('abcdefghijklmnopqrstuvwxyz'));
function fearNotLetter (str) {
for (var i = str.charCodeAt(0); i <= str.charCodeAt(str.length - 1); i++) {
let letter = String.fromCharCode(i);
if (str.indexOf(letter) === -1) {
return letter;
}
}
return undefined;
}