Hello, my name is: Amy

Make This Work

Make this work:

duplicate([1,2,3,4,5]); // [1,2,3,4,5,1,2,3,4,5]

(Yaaay! Something like codewars!)

Seems like there is a better way to do this, but this was first attempt:

function duplicate(arr) {
  var txt = arr.join();
  arr = (`${txt},${txt}`).split(',').map(function(el) {
    return Number(el);
    })
  return arr;
}

Comments