Missing letters **MY Bad Code**

Tell us what’s happening:

My code works but seems very heavy compared to the solution. Is this that bad of code?

Your code so far

Summary
function fearNotLetter(str) {
  let split = str.split('');
  let b = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"];
 let missingLetter = undefined;
 let refrenceArray = "";

for(let i=0; b.length > i; i++){
 if (split[0] == b[i]){
 refrenceArray = (b.slice(b.indexOf(b[i])))
 console.log(refrenceArray)
}}

  for (let j = 0; split.length > j; j++){ 
     if(str[j].localeCompare(refrenceArray[j]) == 1){
      return missingLetter = refrenceArray[j]
     }
  }
  return missingLetter;
 }

fearNotLetter("abce");

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/missing-letters/

I hid details of your solution so you are not just giving away solutions.

As long as your code works, I don’t consider it bad. Sure, it can be inefficient but it’s fine since you are only learning how to code.

I would study the official solution and try to understand the logic behind it, so that whenever you face a similar problem, you can apply what you learned.

Thanks for your help. I have been hacking at this for awhile and I understand the given solution but don’t feel like I would come to the on my own. Sorry for exposing code, I didn’t realize.

No worries.

You can post snippets of code you don’t understand and we can help you understand it.