Skip to content

2796. Repeat String 👍

1
2
3
4
5
6
7
8
9
declare global {
  interface String {
    replicate(times: number): string;
  }
}

String.prototype.replicate = function (times): string {
  return Array(times).fill(this).join('');
};