All academies
All challenges

Repeat a String

easybasics50 XP

Problem

Write a function repeatString that takes a string and a count, and returns the string repeated that many times. Type both parameters and the return value. A count of 0 should return an empty string.

Expected output

ababab
xxxxx

Hints

Stuck? Reveal hints one at a time.

Solution

Try solving it yourself first — revealing is always available.

Press Run in the editor — your console output is checked automatically.
No errors
Loading...

Console output appears here. Press Run or just type — the code compiles automatically.