Array Example

This array populates a name when you click the button

by wooozy

HTML

<button id="button1">Pick One </button>

JavaScript

var button = document.getElementById("button1");

var myarray = ["James", "Katherine", "Micheal", "Ryan"," Christopher","Staurt",
 "Kartik","Daniel","Jeffrey","Kyle","Ronald","Erik","James","Juan",
 "Andrew","Heather","Christian", "Fransico","Kyle", "Andrew I",   "Jimmie","Vannak","Joxongir", "Micheal K","Alan",              "Micheal","Jordan","Rodrigo","Kristin","Gabriel",
"Chester","Felix","Phillip","Terralyn","Jewell","Jason","Jacob",
"Brendan","Rupal","Jeffrey","Daniel","Gary"];

button.onclick = function() {
    alert(myarray[Math.floor(Math.random() * myarray.length)]);
};