Yeah I just done it now by looking up the same issue I had (I didn’t know I could just paste the step I was on…)
I just got it sorted right before I realized it was only “F” I was looking for.
Side question, how come my way wouldn’t of worked? or how would I make it work? Using my array method to check if this had that and so on, interested to know.
getGrade(score) is returning a letter grade, correct?
and pass is an array…
So what happens when getGrade returns a F for eg. Your if statement will be:
if ( ‘F’ <= [“A++”, “A”, “B”, “C”, “D”])
What should this return that would be helpful here?
I am still trying to wrap my head around some of the concepts, I feel like I get them then I lose it. Reading into it more it mentioned that I can’t compare a string to an array.
From what I now think I understand is that they are not the same data type so I cannot do that?
Sorry if that seems like a dumb question but it’s what I think I understand at the moment.
If I can ask you to please give the OP a chance to think for themselves in future, as part of learning is at least trying to communicate ideas and work through the issues with them.
So what I was trying to achieve, from how I understood it was to got back to my function (getGrade) and go over where my A - D’s were (if’s & if else. statements) Then have those conditions meet back then to be brought forward to my new if statement. (if (score === 100) { return “A++”) then going to my new function to then see, if I had “A++” there then it should match and be true and so on with the other letters I had given it. I just had and else statement without including F in my list but that didn’t work either.
I completely looked over the question as it was my first thought. As I type it out to explain what it was I was trying to do, it didn’t sound too great now since I actually read the question to solve it.
But does that make sense what I was trying to do? Feel free to ask me to explain it again as it would be good for me to explain my thoughts and issues more clearly. in future.
So you did manage to get the string grade. But the part that was wrong was how you were trying to compare it to the array. When trying to compare a string to the array there are multiple ways to do so, depending on what you’re comfortable doing. If you can’t recall how, then try to do a google search “in js how to compare a string to an array” and you will see various answers.
You certainly could make this method work, but as you found out earlier, it was easier to just check if the grade was an F.