--- tags: mstu5003, doodle --- # Data of a daily life --- ```:javascript= // Jessie Feng is a girl who just graduate from the college. let name = "Jessie Feng"; let age = 23; let female = true; //on records the start time, down records the end time. let time; let on; let down; //wake up button starts timer and reminds to eat breakfast. function wake(){ //Timer pops up a warning window every 2000ms to indicate the text. time=setInterval(function(){ alert("Eat breakfast please") },2000) //Record click time. on=Date.now() confirm(arr[1]) } //Sleep button and end the timer. function sleep(){ //Clear timer and pop up warning window for text. ClearTimeout(time) alert("Nighty Nighty") //Record click time. down=Date.now() //Pop-up warning window to calculate the time difference between the two events. alert("waking hours"+(down-on)+"s") } //Create an array of restaurants. var arr=["Absolute Bagels","Panda Express","Popeyes","Junzi Kitchen","Uncle Luoyang"] //Start using the choice method function choice(){ let num=0; var r=confirm("what to eat today"+arr[num]); //while loop, when false is selected, the array is incremented while(r==false&&num<5){ num++ r=confirm("what to eat today"+arr[num]) } //Jump out of the loop when true is selected and pop out the last array element. if(num<=5){ alert("ok"+arr[num]) }else{ //A warning box pops up when all selections are false. alert("Are you not hungry?") } } ```