Repeat String

Published by Werdna in

Create a function that takes a string $txt and a number $n and returns the repeated string $n number of times.

If given argument $txt is not a string, return Not A String !!

Examples

repeatString("Mubashir", 2) ➞ "MubashirMubashir"

repeatString("Matt", 3) ➞ "MattMattMatt"

repeatString(1990, 7) ➞ "Not A String !!"

Notes

  • Don't forget to return the result.
  • If you get stuck on a challenge, find help in the Resources tab.
  • If you're really stuck, unlock solutions in the Solutions tab.
Watch a quick demo on how Edabit works.