Repeats an array given times. 📦 😺 🏃 📼 🌔 📜 📰 📘 Similar: repeat, cycle, rotate, reverse. This is part of package extra-array. array.repeat(x, [n]); // x: an array // n: times (1) const array = require("extra-array"); var x = [1, 2]; array.repeat(x, 2); // [ 1, 2, 1, 2 ] array.repeat(x, 3); // [ 1, 2, 1, 2, 1, 2 ] References String.prototype.repeat: MDN web docs Collections.nCopies: Java