此函数将指定的字符串重复指定的次数。
String.prototype.repeat(count) - 语法
str.repeat(count)
count - 字符串应重复的次数。
String.prototype.repeat(count) - 返回值
返回一个新的字符串。
String.prototype.repeat(count) - 示例
var myBook=new String("Perl"); console.log(myBook.repeat(2));
运行上面代码输出
PerlPerl