Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

repeat an array multiple times 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 #multiple #times #js
ADD COMMENT
Topic
Name
3+9 =