text: Q:
  
  push duplicate values into array based on length provided
  
  I want to insert duplicate values into array based on length provided like this:
  var a = ['bar', 'google', 'mod'];
  var b = [];
  
  var dataLength = 4;
  
  output should look like: var a = ['bar', 'bar','bar','bar', 'google', 'google', 'google', 'google', 'mod', 'mod','mod', 'mod'];
  I tried this:
  var dataLength = 4;
  var a = ['bar', 'google', 'mod'];
  var b = new Array(dataLength);
  var c = [];
  
  for (let i = 0; i < a.length; i++) {
      c.push((b.fill(a[i]).toString()))
  }
  
  It works but not sure this is a good way to do this.
  
  A:
  
  Try this:
  
  const a = ["barclays", "google", "vod"];
  
  const result = (num) => a.reduce((acc, ele) => acc.concat(Array(num).fill(ele)), []);
  
  console.log(result(10))
  
  