num times(第二个参数)重复给定的字符串str (第一个参数)。如果num不是正数,则返回空字符串。如果卡住,请记得使用Read-Search-Ask 。编写自己的代码。 repeatStringNumTimes("*", 3)应该返回"***" 。'
testString: assert(repeatStringNumTimes("*", 3) === "***");
- text: 'repeatStringNumTimes("abc", 3)应该返回"abcabcabc" 。'
testString: assert(repeatStringNumTimes("abc", 3) === "abcabcabc");
- text: 'repeatStringNumTimes("abc", 4)应返回"abcabcabcabc" 。'
testString: assert(repeatStringNumTimes("abc", 4) === "abcabcabcabc");
- text: 'repeatStringNumTimes("abc", 1)应该返回"abc" 。'
testString: assert(repeatStringNumTimes("abc", 1) === "abc");
- text: 'repeatStringNumTimes("*", 8)应该返回"********" 。'
testString: assert(repeatStringNumTimes("*", 8) === "********");
- text: 'repeatStringNumTimes("abc", -2)应返回"" 。'
testString: assert(repeatStringNumTimes("abc", -2) === "");
- text: 不应使用内置的repeat()方法
testString: assert(!/\.repeat/g.test(code));
```