目录

String.prototype.repeat(count)

此函数重复指定的字符串指定的次数。

语法 (Syntax)

str.repeat(count)

参数 (Parameters)

  • Count - 字符串应重复的次数。

返回值 (Return Value)

返回一个新字符串。

例子 (Example)

var myBook = new String("Perl"); 
console.log(myBook.repeat(2)); 

输出 (Output)

PerlPerl 
↑回到顶部↑
WIKI教程 @2018