Tell us what’s happening:
Step 30
To calculate the occurrence you can use the following approach:
Example Code
const numbersArr = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4];
const counts = {};
numbersArr.forEach((el) => {
if (counts[el]) {
counts[el] += 1;
} else {
counts[el] = 1;
}
});
Check if the current number is already in the counts object. If it is, increment it by 1. If it is not, set it to 1.
Resulting object. The keys are the numbers from the array and the values are the number of times each num
this step’s instructions are barely comprehensible . “calculate the occurrence” without specifying what one is supposed to be calculating the occurrence of is not idiomatic English. I understand we’re talking about the mode, but as far as I know, no one uses the phrase “calculate the occurrence”, with no object, to describe that.
and what is “Resulting object .” supposed to mean? that’s obviously not a grammatical sentence, and nothing about the context makes it any more sensical.
I hate being a stickler about “correct” language. this is just gibberish, though.