Repeating Letters N Times

Published by Helen Yu in

Create a function that repeats each character in a string n times.

Examples

repeating("mice", 5) ➞ "mmmmmiiiiiccccceeeee"

repeating("hello", 3) ➞ "hhheeellllllooo"

repeating("stop", 1) ➞ "stop"

Notes

N/A

Watch a quick demo on how Edabit works.