There was an error while loading. Please reload this page.
Repeat an iterable given times.
Similar: repeat, cycle, rotate, reverse.
function repeat(x, n) // x: an iterable // n: times [-1 ⇒ Inf]
const xiterable = require('extra-iterable'); var x = [1, 2]; [...xiterable.repeat(x, 2)]; // → [1, 2, 1, 2] [...xiterable.repeat(x, 3)]; // → [1, 2, 1, 2, 1, 2]