Answers for "duplicate an array in javascript n times"

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
0

duplicate numbers in an array javascript

[1, 1, 2, 2, 3].filter((element, index, array) => array.indexOf(element) !== index) // [1, 2]
Posted by: Guest on November-10-2020

Code answers related to "duplicate an array in javascript n times"

Code answers related to "Javascript"

Browse Popular Code Answers by Language