JSFiddle - React, Tailwind, and code Playground
by dfsq
HTML
<div class="output"></div>
<div class="question"></div>
<button>Run</button>
CSS
.output span {
display: inline-block;
background: #DDD;
padding: 5px;
margin: 5px;
width: 50px;
height: 50px;
text-align: center;
}
.question {
background: coral;
height: 100px;
width: 100px;
padding: 5px;
}
JavaScript
var Quest = ["value1", "value2", "value3", "value4"].slice();
$('button').click(function() {
var random = Quest.splice(Math.floor(Math.random() * Quest.length), 1)[0];
// Show random question
$('.question').text(random);
// print what remains in the array
$('.output').empty();
for (var i = Quest.length; i--; ) {
$('.output').append('<span>' + Quest[i] + '</span>');
}
});