setInterval(function(){
console.log("Hello");
console.log("World");
}, 2000); //repeat every 2s
// best implementation
repeatStr = (n, s) => s.repeat(n);
let text = 'Hello world!';
let result = text.repeat(4);
console.log(result);
function repeatStringNumTimes(str, num) {
if (num < 1) {
return "";
} else {
return str + repeatStringNumTimes(str, num - 1);
}
}