Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

repeat array in js

const makeRepeated = (arr, repeats) =>
  [].concat(...Array.from({ length: repeats }, () => arr));
  
console.log(makeRepeated([1, 2, 3], 2));
Comment

PREVIOUS NEXT
Code Example
Javascript :: mongoose unique validator 
Javascript :: how to rotate an array in javascript 
Javascript :: indexof method javascript 
Javascript :: focus element javascript 
Javascript :: how to handle fetch errors 
Javascript :: jquery post 
Javascript :: react blur background 
Javascript :: how to filter json array in javascript 
Javascript :: how to submit form on changed url in function in jquery 
Javascript :: javascript sum table row values 
Javascript :: default Electron icon is used reason=application icon is not set 
Javascript :: usereducer example 
Javascript :: addition of all elements of array in js 
Javascript :: react native red triangle up 
Javascript :: use bootstrap 5 with vue 
Javascript :: use setstate in function component 
Javascript :: select field in react native 
Javascript :: npm run build npm ERR! Missing script: "build" for firebase 
Javascript :: reactjs node sass incompatible with ^4.0.0 ^5.0.0 
Javascript :: how to get variable in local storage in javascript 
Javascript :: javascript array delete first element 
Javascript :: spotify web player 
Javascript :: Web History API 
Javascript :: write to file but dont overwrite fs.writeFile node 
Javascript :: how to disable and enable a button in jquery 
Javascript :: mongoBD increment 
Javascript :: frequency of characters in a string in javascript 
Javascript :: how to get sum array in javascript 
Javascript :: base href angular 
Javascript :: how to chunk a base 64 in javascript 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =