JSFiddle - React, Tailwind, and code Playground
by cdhowie
HTML
<button onclick="selectItem()">Select an item</button>
<div id="results"></div>
JavaScript
(function () {
var options = ['a', 'b', 'c', 'd', 'e'];
window.selectItem = function () {
if (options.length === 0) { return; }
var n = Math.floor(Math.random() * options.length);
document.getElementById('results').innerHTML += options[n];
options.splice(n, 1);
};
}());