JSFiddle - React, Tailwind, and code Playground
HTML
<button onclick="generate();">Generate password</button>
<p id="pw">
<!-- password should go here -->
</p>
<script>
var arr = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
function generate () {
for (i = 0; i < 10; i++) {
randomLetter = arr[Math.floor(arr.length * Math.random())];
console.log(randomLetter);
}
}
</script>