repeatText 🌶️
Your group chat needs a laugh. Write a method repeatText that takes a String s and an int n and returns s repeated n times in a row. If n is 0, return the empty String.
For example, repeatText("ha", 3) is "hahaha", and repeatText("go ", 2) is "go go ".
How many times should the loop body run if
n is 3? And if n is 0?Start with
String result = ""; and add s to it each time through the loop. Return result after the loop.