[Die algorithm game] Would this have been a logically valid equivalent to one of the steps?

This is the function for getHighestDuplicates, where the course asks you to find the highest number of duplicates in the array of random dice values and output the sums of everything if there are 3 or 4 of a kind, and 0 if not.

This is what I came up with, it didn’t pass, & i need to catch up with some completion timeline thing im putting on myself so I didnt want to fully investigate this, but it looks right to me and I think I got one aspect of it wrong maybe. And I also know the compiler can be finicky about nomenclature sometimes. (This is my solution compared to the one that is prepared if you skip ahead, which is structured much differently with multiple iteration structures). Idk it looks right to me:

const getHighestDuplicates = (array) => {
const counts = ;
for (let i =0; i<array.length; i++){
const count = array.filter(i === array[i]);
counts.push(count.length);
}
if(counts.includes(4)){
updateRadioFunction(1, array.reduce((a,b) => {a+=b}, 0));
} else if(counts.includes(3)){
updateRadioFunction(0, array.reduce((a,b) => {a+=b}, 0));
} else {
updateRadioFunction(5, 0);
}

};

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

I don’t think your bounds for i are adequate. What are the possible values of the dice?