Skip to main content

--description--

Find the missing letter in the passed letter range and return it.

If all letters are present in the range, return undefined.

--hints--

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'));

--seed--

--seed-contents--

function fearNotLetter(str) {
return str;
}

fearNotLetter("abce");

--solutions--

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

return undefined;
}