JSFiddle - React, Tailwind, and code Playground
JavaScript
String.prototype.shuffle = function () {
var a = this.split(""),
n = a.length;
for(var i = n - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var tmp = a[i];
a[i] = a[j];
a[j] = tmp;
}
return a.join("");
}
var word = "myword";
var shuffledWord = word.shuffle();
for (var i = 0; i < shuffledWord.length; i++ ) {
createButton(shuffledWord[i]);
}
function createButton(letter) {
$("body").append($("<button/>").html(letter).on("click", function() {
// Here your button handling code
alert($(this).html());
}))
}