Repeat String

Published by Deep Xavier in

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

Return "Not a string!" if given argument t is not a string,

Examples

repeatString("Tesha", 2) ➞ "TeshaTesha"

repeatString("Deep", 3) ➞ "DeepDeepDeep"

repeatString("Matt", 4) ➞ "MattMattMattMatt"

repeatString(2000, 7) ➞ "Not a string!"

Notes

  • 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.