题目如上
function repeatStr (n, s) { var str = ""; for(var i=0;i<n;i++) { str += s; } return str; }
//使用repeat function repeatStr (n, s) { return s.repeat(n); }
根据给定的数字和字符串,生成循环指定次数的字符串
原文:http://www.cnblogs.com/kugeliu/p/7242307.html