I run a small site of text tools, and the most used one is a text repeater: type a word or emoji once, choose a count, copy the result. Here's how it works and the gotchas I hit.

The core

function repeat(text, count, sep) { return Array(count).fill(text).join(sep); } 

Array(count).fill(text).join(sep) is fast enough for 100,000 copies on a phone. A naive += loop is much slower on large counts.

Gotchas

  • Size limits. 'I love you' 10,000 times on new lines is ~110,000 characters. WhatsApp allows 65,536 per message, so I show a live size (new Blob([out]).size) before the user copies.
  • Emoji. Never reverse or slice strings with split(''); use Array.from(str) or Intl.Segmenter so emoji and Hindi text don't break.
  • Clipboard on mobile. navigator.clipboard.writeText needs a user gesture; keep the copy inside the click handler.
  • Privacy. Everything runs client-side, so nothing is uploaded.

Try it

The live version is repeat text on RepeatText. If you just want a quick text repeater for WhatsApp or emoji, it's free with no signup. For big jobs there's a repeat text generator that splits long output into parts.

Feedback welcome in the comments!