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