I dont understand why 3rd case doesnt work. I think it’s a bug with slice, but im not sure;
function fearNotLetter(str) {
let abecedario = 'abcdefghijklmnopqrstuvwxyz';
let start = abecedario.indexOf(str[0])
let finish = abecedario.indexOf(str[str.length-1])
abecedario = abecedario.slice(start,((finish-start)+1))
for (let i = 0; i < abecedario.length; i++){
if (str.indexOf(abecedario[i]) == -1){
return abecedario[i]
}
}
return undefined;
}
fearNotLetter("stvwx");
slice gives an empty string if i use the 2nd argument with any number, only in this case