Missing letters but in different way

Tell us what’s happening:
Describe your issue in detail here.
i want to write the alphabet in new variable and want to compare it with the provided string , but i do not know how to do it , can someone help me please

  **Your code so far**

function fearNotLetter(str) {
let alphabet = 'abcdefghijklmnopqrstuvwxyz'
for(var i=0; i<str.length; i++){
  
}
return undefined;
}

console.log(fearNotLetter("abce"));

I’m not sure I understand what this means? Can you give us a little more detail on how you want to compare the alphabet string to the string passed into the function?

i want to compare the provided string with the alphabet variable , so if the code finds any letter missing , it will output that letter

How would you find the missing letter if the strings were, say, written on a sheet of paper? Step by step.

Gotcha. As @colinthornton said, describe what you would do, don’t worry about coding it yet. Some things to thing about:

  • Will the string passed into the function always be in alphabetical order?
  • Can there be more than one missing letter in the sequence?
  • Can there be characters in the string other than letters?
  • Will the input string have uppercase letters?
  • What do you return if there are no missing letters?

because i already know the alphabet, i just look at the sheet and tell the missing letter or i will write alphabet in another line and compare

Pretend you don’t already know the alphabet. Or if that is too hard, describe the process to someone who doesn’t know the alphabet. But even if you know the alphabet, you are still going through a process to figure out which letter is missing.

for this challenge
yes
no
no
no
‘no missing letters’ or ‘undefined’ as in challenge

Well that’s boring :slight_smile:

OK, this is pretty straight forward then. I’m sure you can describe how you would go about figuring out which letter is missing.

if i dont know the alphabet i’ll get it from online or ask to any friend and write it down and compare each letter from start

sir, i want to know the solution for this , even though it’s not related to the challenge

  • Will the string passed into the function always be in alphabetical order?
  • Can there be more than one missing letter in the sequence?
  • Can there be characters in the string other than letters?
  • Will the input string have uppercase letters?
  • What do you return if there are no missing letters?

but i dont know how to code that

OK, we are starting to get somewhere. It sounds like you want to do a comparison letter by letter in str with the alphabet. So you are going to start at the beginning of str and go through each letter in str. It looks like you have set up the for loop to do that. I’m assuming you know how to access an individual character in a string? If not then you have some googling to do.

Once you know how to access each individual character in str then you know how to access an individual character in alphabet as well. The twist is that you need to figure out where the first letter in str is located in alphabet so you know where to start in alphabet.

I’ve got to run for the night (I’m old and it’s getting late here). Good luck. Hopefully I gave you enough to go on.

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