Generate a random string with given length
JavaScript version
const generateString = (length) =>
Array(length)
.fill('')
.map((v) => Math.random().toString(36).charAt(2))
.join('');
TypeScript version
const generateString = (length: number): string =>
Array(length)
.fill('')
.map((v) => Math.random().toString(36).charAt(2))
.join('');