I have this array:
var arr = [
{class: 'class-1', team: 'abcdef'},
{class: 'class-21', team: 'xmsqmd'},
{class: 'class-4', team: 'xaksjs'},
{class: 'class-21', team: 'xmsqmd'},
{class: 'class-5', team: 'asioda'},
{class: 'class-44', team: 'csdcsw'}
];
as you can see, this object:
{class: 'class-21', team: 'xmsqmd'}
is repeated 2 times. Anyways this is just an example, but I need to create another array that should look like this:
newArr = [
[{class: 'class-1', team: 'abcdef'}, 1],
[{class: 'class-21', team: 'xmsqmd'}, 2],
[{class: 'class-4', team: 'xaksjs'}, 1],
[{class: 'class-5', team: 'asioda'}, 1],
[{class: 'class-44', team: 'csdcsw'}, 1]
]
so the new array should be a 2d array with the first value being the object and the second being the times it's repeated.
thanks in advance, I've searched but I only found a solution with the result being an array with an object with the key being the stringified object.