Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

duplicate elements of array multiple times

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

PREVIOUS NEXT
Code Example
Javascript :: is jwt token expired 
Javascript :: express server sockjs 
Javascript :: for each loop with arrowfunction 
Javascript :: how to remove property from object javascript 
Javascript :: js code sample 
Javascript :: generate numbers from 1 to 100 to array 
Javascript :: react 18 
Javascript :: react native safeareaview 
Javascript :: reactjs join two array 
Javascript :: generate apk debug react native 
Javascript :: js stop typing event 
Javascript :: regex must match exactly 
Javascript :: getfullyear javascript 
Javascript :: slice method in js 
Javascript :: django ajax body to json 
Javascript :: generate random special characters javascript 
Javascript :: http node 
Javascript :: js if else 
Javascript :: create select option using jquery 
Javascript :: select distinct on expressions must match initial order by expressions django 
Javascript :: getFullYear within moment in angular 
Javascript :: find property in nested object 
Javascript :: how to make a string with unique characters js 
Javascript :: infinite scroll jquery 
Javascript :: cookie in javascript 
Javascript :: javascript how to extract a value outside function 
Javascript :: react js pdf generate from html 
Javascript :: radio javascript checked 
Javascript :: largest and smallest number in an array 1-100 javascript 
Javascript :: how to emty an array in javascript 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =