1const chorus = 'Because I\'m happy. ';
2
3console.log(`Chorus lyrics for "Happy": ${chorus.repeat(27)}`);
4
5// expected output: "Chorus lyrics for "Happy": Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. Because I'm happy. "
6
1setInterval(function(){
2 console.log("Hello");
3 console.log("World");
4}, 2000); //repeat every 2s
1function repeatStringNumTimes(string, times) {
2 var repeatedString = "";
3 while (times > 0) {
4 repeatedString += string;
5 times--;
6 }
7 return repeatedString;
8}
9repeatStringNumTimes("abc", 3);