Missing letters next step?

Hey I think I understand the charCodeAt and fromCharCode concepts but I’m not sure how I can check for differences in each index of str in order of index in alphabet.

My code is not complete and I understand it’s currently just checking if str[i] has a please let me know what to look at doing next.

Thanks

  **Your code so far**

function fearNotLetter(str) {
// initialize full alphabet
let alphabet = "abcdefghijklmnopqrstuvwxyz";
// get ASCII code using charCode
let code = alphabet.charCodeAt(); // 97
// convert ASCII back to string
let convertedStr = String.fromCharCode(code); // a
// check for differences in ASCII code between str and alphabet
for (let i = 0; i < str.length; i++) {
  if (!str[i].includes(convertedStr)) {
    return 
  }
}
// if there is a missing letter return the missing letter, else return undefined


return str;
}

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

  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36.

Challenge: Missing letters

Link to the challenge:

Yeah unfortunately I couldn’t get to that point. I did try thinking that way and commenting it out first but ended up here.

I would go through the sequence of str and check it with the alphabet (a,b,c then see it’s missing d). If it’s missing a letter in sequence I’d know which one.

I thought maybe use loop to go through but not sure how to do the part where I’m comparing to each index off alphabet based on which part it contains and check it with one another.

I know it’s best to write it out without code, check mozilla docs, and look at the hint. Sucks nobody can tell but I really do follow these steps. Maybe I just don’t do it well I guess… But I don’t know how to do it better than I have. I’m only posting a question when I can’t seem to make more progress

I’ll compare it with the sequence in that portion of the alphabet. I initialized this as

It might help to console.log the charCodes for a string like "abce" or "stvwx".

@RandellDawson

  1. I will read abce
  2. I will know that abcde is the order needed
  3. I will realize that it’s missing d because I know it needs to be abcde

Hope this helps I’m sorry I don’t understand how else to explain it

@jsdisco I actually did this and commented the result which seems to be the first index if there is to argument inside charCodes but I don’t know how to get it to where I need for this challenge.

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