Learn Algorithmic Thinking by Building a Dice Game step 85

I keep getting the error: You should call your updateRadioOption with 3 and 30 for the arguments. I have tried tweaking little bits of the syntax that are hit and miss with getting flagged on fcc. Nothing changes the error. I have tried restarting my computer, refreshing the window, deleting and retyping the block, copying and pasting the specific line, minus the numbers, from elsewhere else in the code and I still get the same error. In the log, it gives an error that “straight” is not defined, but that is never listed in the suggested correction message. Have I been staring at this so long that something obvious is eluding me?

for(straight of smallStraightsArr) {
if (uniqueNumbersStr.includes(straight)) {
updateRadioOption(3, 30);
}

Hi, welcome to the Forum.

Yes, the error is correct: straight is not defined.
Whenever you need a new variable you have to declare it by using const or let, for example. (even if it is in a for loop) :smile:

Oh man, I actually really like for…of loops. I can’t believe I missed that. Thank you!

For the sake of learning, do you know of a reason that missing the variable declaration in the loop would prevent updateRadioOption from being called? My code was clearly flawed, but I’m also trying to understand if the correction message indicating updateRadioFunction was not being called was just a default message or truly connected to my error.

if you don’t declare a variable you have a syntax error that stops everything from working, check the console with an undeclared variable

Got it. So, the moral of the story is: Pay attention to all the information being given, not just the correction message. I’ll keep in mind to not narrow my focus so quickly next time. Thank you.