If you need a string of a certain length but don't care so much about the content, this one-line function is just what you are looking for!
const generateString = length => ''.padEnd(length, 'ABC123')
And you can create strings of any length without directly pasting a huge string.
generateString(200)
'ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123ABC123AB'
Top comments (0)