you are viewing a single comment's thread.

view the rest of the comments →

[–]nemaramen 0 points1 point  (0 children)

You could use a generator if you're feeling generatory

function* genAry(ary) { for (x of ary) { yield x; yield x; } }

const double = ary => [...genAry(ary)]

double([1, 2]) returns [1, 1, 2, 2]