JSFiddle - React, Tailwind, and code Playground

by Tori Hoelscher

HTML

<h1>Picking a random name from the array:<br> </h1>

<h2>

     <p id = "textName" style="color:blue"> </p>   

</h2>

<button onclick="pickA()">Pick One</button>

JavaScript

var mems= New Array ("Tori","Jordan"):
function pickName () {
var index = Math.floor(Math.random() *mems.length);
document.getElementById("textName").innerHTML= mems[index];

}