<<<<<<< HEAD Code Wars - Brett Crafton

String repeat

Question

Write a function called repeatStr which repeats the given string string exactly n times.

repeatStr(6, "I") // "IIIIII" repeatStr(5, "Hello") // "HelloHelloHelloHelloHello"

Solution by -

My Solution


	function repeatStr (n, s) {
		let i = 0  
		let str = ""
		while(i < n){
			str += s
			i++
		}
		return str;
		}
				

Try it yourself - CodeWars

======= Code Wars - Brett Crafton

String repeat

Question

Write a function called repeatStr which repeats the given string string exactly n times.

repeatStr(6, "I") // "IIIIII" repeatStr(5, "Hello") // "HelloHelloHelloHelloHello"

Solution by -

My Solution


	function repeatStr (n, s) {
		let i = 0  
		let str = ""
		while(i < n){
			str += s
			i++
		}
		return str;
		}
				

Try it yourself - CodeWars

>>>>>>> 0e614172debaa009c8d31330edbeb3b765b59c39