Missing letters Intermediate Algorithms

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;


slice gives an empty string if i use the 2nd argument with any number, only in this case

I would brush up on the slice documentation to make sure you are using it properly. Pay special attention to what the second parameter is.


Thanks bud, i had it wrong

I get it confused with splice all the time as well :slight_smile:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.