Hello, from a search on FCC one issue is using the array name as a param, you should try arr in place of it. Also the two let variables are split up into separate parts with the required logic. const counts = {};
let totalScore = 0; the rest seems ok but some are using numbers in place of strings. 4,3, 5 and 0. Good luck
In the updateRadioOption the first parameter is index.
I also get mulitple of these - “[TypeError: Cannot set properties of undefined (setting ‘disabled’)]” and one of these "Uncaught ReferenceError: diceValueArr is not defined
[ReferenceError: diceValueArr is not defined] "
Does the second one have anything to do, that my diceValueArr is an empty array?
It could be two functions,one with the counts var and the other with the letScore at the top of each one, I wouldnt be too concerned about the updateRadioBuntton variable but yes that was it. If you type in the heading to this step 7 or google it you might be supprised at how this one goes because their using a for keyword and a condition like an if statement with some words, something I cant figure out at this point.
I suggest fixing all the calls to update the radio buttons to use an actual index and not a string. I also suggest that you play the game and see if it works as described by the step.
Finally, and this is an issue with the step itself, be sure to update the last radio button regardless of the maxCount (or update that last radio button all the time).
what I understood there is that, the update radioButton function Shud b called in each of the if statement conditions, while updating the last radiobutton option or the updateRadionButton(5,0) Shud be included in the getHigherDuplicates function itself
not quite what I meant but thank you for telling me what you understood.
What I was saying was a comment about the last radio button only.
In the step they say:
If neither of those are true, the final option should be updated with a score of 0
But what I’m saying is, ignore this instruction and ALWAYS update the final option with the score of 0.
(do not update it under a specific condition being true or false, just update it every time your new function gets called)
Not sure if this is still an issue but one thing i have noticed is you made a function getHighestDuplicates, that function has a placeholder of diceValuesArr.
when you click the rollDiceBtn and call the getHighestDuplicates function you do not put in a parameter to take place of the diceValuesArr placeholder. There is no reference as to what diceValuesArr placeholder should be when the function executes.
i fiddled around with your code and found 3 issues with the original post. until i got the correct answer
you do not reference what the placeholder should be when calling getHighestDuplicate function.
the updateRadioOption takes a number instead of a string in the index. (COUNTING STARTS FROM 0 )
ON CONDITION that maxCount is LESS THAN or Equal to 2 update the last radio option to have a score of 0. edit, the code passes without a condition so the only issues were the top 2. oops XD