Why is this code not working?

Tell us what’s happening:

Your code so far

function fearNotLetter(str) {
  var x = str.charCodeAt(0);
  var y = str.charCodeAt(str.length-1);
  var aw = 0;
  var sub = [];
  var bw = 0;
  var str2 = str.split("");
  for(var i=x;i<=y;i++)
      for(var j=0;j<str2.length;j++)
      return undefined;
      return sub;


Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36.

Link to the challenge:

You did not include an answer to “Tell us what’s happening”. What have you tried? What isn’t working as expected? What tests are failing? What don’t you understand? What do you understand?

Why don’t you explain to us why you think this code should be working?

You are supposed to be returning either a missing letter (a string) or undefined. For featNotLetter(“bcd”), your solution is returning an array of the individual letters passed to the function. I would start by figuring out why your solution is returning an array instead of a string in this example. Also, try to use variable names which describe what the values means instead of x, y, aw, bw, etc… The more readable you make your code, it will help others to understand what you are attempting to do and then make it easier for them to guide you with hints on what to correct.