Repeats the given element by the given count of times.

Type signature

(count: number) => <T>(value: T) => T[]

Examples

repeat(3)("test");
// ⇒ ["test", "test", "test"]
Try in REPL

Questions

  • How to repeat a value N times?

TypeScript sourceJavaScript source