return string.repeat(number); javascript code example Example: string repeat javascript // best implementation repeatStr = (n, s) => s.repeat(n);