function repeatStringNumTimes(str, num) {
let newstr = '';
if (num < 0) {
return "";
} else {
for (let i = 0; i < num; i++ ) {
newstr +=str;
}
}
return newstr;
}
console.log(repeatStringNumTimes("abc", 3)); // abcabcabc
console.log(repeatStringNumTimes("*", 3)); // ***
console.log(repeatStringNumTimes("*", -1));