2796. Repeat String ¶ TypeScript 1 2 3 4 5 6 7 8 9declare global { interface String { replicate(times: number): string; } } String.prototype.replicate = function (times): string { return Array(times).fill(this).join(''); };