Problem With Code
So I have this code: do a random event //information var name, age = 0; //declaring information name = prompt("What is your name? Don't Enter anything for random."); //this is used to randomize stuff var randomizer; //ages 1-10 events var KidEvents = [""] Randomize(); //randomizing the name if(name == "") { name = "Phil"; } //printing the name document.write("Name: " + name); function AgeUp() { for(; age <= 10; age++) { var randomEvent = Randomizer(); //run Randomize(); var event = null; //if what it returns is 1, then do a random event if(randomEvent == 1) { ChooseEvent(); } document.write("</br>" + age + event); } } function Randomize() {//when this is called, it will randomize randomizer //picks a number between 1 and 2 randomizer = Math.floor((Math.random() * 2) + 1); return randomizer; } function ChooseEvent() { //ages under or equal to 10 if(age <= 10) { //the events var event = new Array("Got Potty Trained", "Learned To Walk", "Started DayCare/School", "Learned to talk", "Diagnosed With Common Cold"); //returns one of the random events var eventChooser = Math.floor((Math.random(event.length) + 0)); return event[eventChooser]; } //if nothing is returned return null; } I don't get why it isn't showing the ages when ran. What I am trying to do is have it so it randomly runs the eventChooser(), but when I run this, it just shows the name, which I don't know.