I know how to generate only one the button. I'm doing it this way:
var mylist = ['first', 'second', 'third', 'fourth', 'fifth']
var rand = Math.floor(Math.random() * mylist.length)
var word = mylist[rand]
var btn = document.createElement('input')
btn.id = 'b1'
btn.value = word
btn.type = 'button'
document.body.appendChild(btn)
But I need to generate a few buttons(for example 3 buttons). document.body.appendChild(btn)
btn.setAttribute('id', 'b1')andbtn.innerHTML = wordsetAttributewhenidis available for free? It's also not wise to insert potentially random HMTL into a button when a value is all that's required.const input = document.createElement('input')theninput.value = 'foo'will create an empty input tag because you can't set the value of a button withvalue