I was trying to implement a [Wordle][1] assistant in JavaScript. I am new to JS, and I am sure the following is trivial, but maps are still confusing me. Suppose I have:
{
  'fight' => [ '02222', '02222', '02222', '02222', '20000' ],
  'eight' => [ '02222', '02222', '02222', '02222', '10000' ],
  'right' => [ '02222', '02222', '02222', '02222', '10000' ],
  'sight' => [ '02222', '02222', '02222', '02222', '10000' ],
  'night' => [ '02222', '02222', '02222', '02222', '10000' ],
  'ferns' => [ '20000', '01000', '00100', '00001', '00010' ]
}
How can I have the counts of unique items in the following format:
[{
    "fight": [1, 4],
    "eight": [1, 4],
    "right": [1, 4],
    "sight": [1, 4],
    "night": [1, 4],
    "ferns": [1, 1, 1, 1, 1]
}]
(Would I do better with a different data structure?)
(These are calculated values, so I have no idea what the keys of data are going to be, neither how many items each key will have.)
 
    