v1
2/23/2022 by cmdcolin -00
disable setup HTML
Setup HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js"></script>
disable setup JavaScript
Setup JavaScript

	let arr = []
    for(let i = 0; i < 100000;i++) {
	    arr.push(Math.floor(Math.random()*100))
    }
delete caserun single casemove downdrag and drop case


ready



const result = arr.reduce((acc, curr) => {
  acc[curr] ??= {[curr]: 0};
  acc[curr][curr]++;
  
  return acc;
}, {});
delete caserun single casemove upmove downdrag and drop case


ready




const uniqueVals = [...new Set(arr)];
const countPerUniqueValArray = uniqueVals.map(uv => arr.filter(i => i === uv).length);
delete caserun single casemove upmove downdrag and drop case


ready



  const res = arr.reduce((acc, curr) => {
    acc[curr] = -~acc[curr];
    return acc;
  }, {});
delete caserun single casemove upmove downdrag and drop case


ready



const hash = Object.fromEntries([ ...arr.reduce((map, key) => map.set(key, (map.get(key) || 0) + 1), new Map()) ]);
delete caserun single casemove upmove downdrag and drop case


ready



const frequency = _.map(_.groupBy(arr), val => ({ value: val[0], frequency: val.length }));
delete caserun single casemove upmove downdrag and drop case


ready



const map = arr.reduce((acc, e) => acc.set(e, (acc.get(e) || 0) + 1), new Map());
delete caserun single casemove updrag and drop case


ready



    const map = {};
    for ( var i = 0; i < arr.length; i++ ) {
        map[arr[i]] = ~~map[arr[i]] + 1;
    }
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN