Answers for "how to find how many times duplicate number in array javascript"

0

duplicate an array in javascript n times

const makeRepeated = (arr, repeats) =>
  Array.from({ length: repeats }, () => arr).flat();
  
console.log(makeRepeated([1, 2, 3], 2));
Posted by: Guest on March-26-2021
4

counting duplicate values javascript

var counts = {};
your_array.forEach(function(x) { counts[x] = (counts[x] || 0)+1; });
Posted by: Guest on May-12-2020

Code answers related to "how to find how many times duplicate number in array javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language