JSFiddle - React, Tailwind, and code Playground

by Ashish Mishra

HTML

<button id='rand'> I am Randomly </button>
<p id='res'></p>

JavaScript

var result1 = ['t1','t2','t3'];
var result2 = ['w1','w2','w3'];
 
var finalres = result1.concat(result2); 



function shuffle(o){ //v1.0
    for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
    return o;
}


  document.getElementById('rand').addEventListener('click', function () {

            document.getElementById('res').innerHTML += shuffle(finalres) + "<br>"; //only for write in document main is 'shuffle(finalres)' that contain random array.
        });