Lets say I have an array
['Student', 'Progress', 'Student', 'Area']
I would like to have an object that looks like this...
 {
    {
      value: "Student",
      count: 2
    },
    {
      value: "Progress",
      count: 1
    }
 }
The code I am using currently is this... which clearly is wrong. Any help would be appreciated.
    const counts = [];
    for (let i = 0; i < array.length; i++) {
        var object = {
                value: counts[array[i]],
                count: (1 + (counts[array[i]] || 0))
        }
        counts.push(object);
    };
    return counts;
 
    