Intermediate Algorithm Scripting - Missing letters

Tell us what’s happening:
Describe your issue in detail here.
My Frankenstein code seems to work, but I’ve been feeling a bit stupid and like I missed classes.

Where can I find the lessons on all the fancy functions? Every lesson seems to throw me into the deep end. Or does everyone just “hit the ground running” hoping not to fall into the rabbit hole?

function fearNotLetter(str) {
  let alfa = "abcdefghijklmnopqrstuvwxyz";
  let letters = str.split("");
  let fl = letters[0];  //first letter
  let ll = letters[(letters.length - 1)]  //last letter
  let io = [] //indexOf array
  let count = []; //alfa count from first to last letter

  for (let i = alfa.indexOf(fl); i <= alfa.indexOf(ll); i++) {
  for (let i = 0; i < letters.length; i++) {
  if (count.length === io.length){
      return undefined;
    } else {

  let notIn = count.filter(l => io.indexOf(l) == -1);
  return alfa[notIn];

Good work getting a solution!

A few thoughts

  1. Use real words for variable names. It helps others (and future you) understtand the code.

  2. You have a lot of intermediate values you don’t need, like ‘count’ and ‘io’.

  3. You should only need one loop.

Before worrying about fancy syntax, I would focus on simplifying your logic. The only way to get good at that is with practice.

Side note - please don’t delete the link to the challenge.

Thanks for the advice, really appreciate it

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