Exercise complete
This commit is contained in:
parent
04e21d84d9
commit
5d2e7b2c34
|
@ -1,9 +1,12 @@
|
|||
const repeatString = function(word, times) {
|
||||
let arr = [];
|
||||
|
||||
|
||||
for (let i = 0; i < times; i++) {
|
||||
arr.push(word);
|
||||
|
||||
if (times < 0) {
|
||||
return 'ERROR';
|
||||
} else {
|
||||
for (let i = 0; i < times; i++) {
|
||||
arr.push(word);
|
||||
}
|
||||
}
|
||||
|
||||
return arr.join('');
|
||||
|
|
Loading…
Reference in New Issue