SOURCE

function repeatStringFinal(str, times) {
    if (times === 0) return '';
    if (times === 1) return str;
    return repeatStringFinal(str, times - 1) + str;
}
 
// 示例
console.log(repeatStringFinal('abc', 3)); // 输出 "abcabcabc"
console 命令行工具 X clear

                    
>
console