pickMyArray

by chris richarde

HTML

<input type="button" id="blue" value="pick one" onClick="pickMyArray();" />
<br/>
<div id="output">
  Hello Dr Eaglin! Please press the button to select student for automatic A for this class.
</div>

JavaScript

var myArray = ["Kristopher", "Ignacio", "Vanessa", "Charlene", "Casey", "Christian", "Adnane", "Nicholas", "Ronald", "Andrew"];

function pickMyArray() {
    "use strict";
    var random = myArray[Math.floor(Math.random() * myArray.length)];
	  document.getElementById("output").innerHTML = random;
}