DEV Community

Discussion on: Solving "Missing letters" / freeCodeCamp Algorithm Challenges

Collapse
 
abhishek_san profile image
Abhishek Prasad • Edited

function fearNotLetter(str) {
let dummy = 'abcdefghijklmnopqrstuvwxyz'
let x = dummy.slice(dummy.indexOf(str[0]))
let s='';

for(let j=0;j<x.length;j++){
if(str.slice(-1) == x.charAt(j)){
s = s.concat(x.charAt(j))
break;
}
else {
s = s.concat(x.charAt(j))
}
}

return s[[...str].findIndex((el, index) => el !== s[index])]
}

fearNotLetter("abce");

Collapse
 
abhishek_san profile image
Abhishek Prasad

i have done it like this do you have any suggestions ....