Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

repeat array in js

const makeRepeated = (arr, repeats) =>
  [].concat(...Array.from({ length: repeats }, () => arr));
  
console.log(makeRepeated([1, 2, 3], 2));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #repeat #array #js
ADD COMMENT
Topic
Name
2+9 =