Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Luke Podnar
1,929 PointsSo, the code is below, the problem is, every input for the yourage var works, up until the input of 7, I'm not sure why
alert("Lots of the questions will be yes and no answers so try to respond with Yes and No answers. Also some answers will have questions like is it fun, hard, or easy, your choices will be surrounded in quoation marks so put that exactly");
var yourname = prompt("Hi, Im Bob, Whats your name?"); alert("Hi " + yourname + " Nice to meet you!");
var yourage = prompt("How old are you?");
switch(yourage) {
case "1":
var yn1 = prompt("Is anyone home with you?");
switch(yn1) {
case "Yes":
alert("Good");
break;
case "No":
var l31 = prompt("Could you go get someone?");
switch(l31) {
case "Yes":
alert("Ok thanks");
var l41 = prompt("Do you do this often?");
switch(l41) {
case "Yes":
alert("Well, theres a first for everything");
break;
case "No":
alert("It seems like you know what your doing");
var l42 = prompt("Do you like doing this?");
switch(l42) {
case "Yes":
alert("Cool me to");
break;
case "No":
alert("If you dont, you shouldnt be doing this then");
break;
}
}
break;
case "No":
alert("Ok well, you probley should be with someone");
var l422 = prompt("Are you alone often?");
switch(l422) {
case "Yes":
alert("Yeah.. Thats not good.");
var l521 = prompt("Do you know what your doing?");
switch(l521) {
case "Yes":
alert("Well, thats better than if you didnt, so thats good.");
break;
case "No":
var l621 = prompt("Will someone be home soon?");
switch(l621) {
case "Yes":
alert("Good");
break;
case "No":
alert("Um, thats bad");
var l721 = prompt("Do you want me to wait with you?");
switch(l721) {
case "Yes":
alert("Ok, good, ill wait with you");
var l821 = prompt("Are you ok with that?");
switch(l821) {
case "Yes":
alert("Ok then, ill wait");
break;
case "No":
alert("Ok then.");
break;
}
break;
case "No":
var l821 = prompt("Are you sure?");
switch(l821) {
case "Yes":
alert("Ok, nothing else I can do");
break;
case "No":
var l921 = prompt("Ok, so you want me to wait with you?");
switch(l921) {
case "Yes":
alert("Ok, good");
break;
case "No":
alert("Ok, well...");
break;
}
}
}
}
}
break;
case "No":
alert("Well, thats good, atleasts it not a lot");
var l1101 = prompt("Do you like being home along?");
switch(l1101) {
case "Yes":
alert("I can understand that, a sense of freeodm");
var l1102 = prompt("Is this all you do when your home along?");
switch(l1102) {
case "Yes":
alert("Im on compueters a lot to");
break;
case "No":
alert("Good, you should do other stuff to");
var l1103 = prompt("Is on of the other things you do healthy?");
switch(l1103) {
case "Yes":
alert("Good, thats nice");
break;
case "No":
alert("Well, I suggest you do, its good for you");
break;
}
}
break;
case "No":
alert("Im suprised, lots of people love doing that");
var l1104 = prompt("Is it scary when your home along?");
switch(l1104) {
case "Yes":
alert("I cant blame you, I was scared easily when I was that young");
break;
case "No":
alert("Well, you seem brave");
break;
}
}
break;
}
}
}
break;
case "2":
var yn2 = prompt("So, Im guessing you can talk?");
switch(yn2) {
case "Yes":
alert("Well, I was right!");
var l32 = prompt("Do you know a lot of words?");
switch(l32) {
case "Yes":
alert("Nice, Good Job");
break;
case "No":
alert("Well, It takes a while to learn");
var l42 = prompt("Are you trying hard?");
switch(l42) {
case "Yes":
alert("Good!, I always do.");
var l52 = prompt("Is it hard?");
switch(l52) {
case "Yes":
alert("I find it easy, hope it gets eaiser");
var l62 = prompt("Do you like learning?");
switch(l62) {
case "Yes":
alert("Some people do, I dont though");
var l72 = prompt("Is it your favriot thing to do?");
switch(l72) {
case "Yes":
alert("I did not expect that, lots of people say no");
break;
case "No":
alert("Same here, like most people im pretty sure");
break;
}
break;
case "No":
alert("Same here, I dont like it at all");
break;
}
break;
case "No":
alert("Same, I dont think its hard");
break;
}
break;
case "No":
alert("Oh, you should, its good!");
var l722 = prompt("Are you going to try?");
switch(l772) {
case "Yes":
alert("Good, its the right choice");
var l872 = prompt("Are you looing forward to it?");
switch(l872) {
case "Yes":
alert("Im suprised, lots of people dont");
var l972 = prompt("When you do, are you going to try your hardest?");
switch(l972) {
case "Yes":
alert("Good, that is really importent");
var l1072 = prompt("Are you going to make this a priorty?");
switch(l1072) {
case "Yes":
alert("Good");
break;
case "No":
alert("You really should");
break;
}
break;
case "No":
alert("Um, you should, it will help you a lot");
break;
}
break;
case "No":
alert("Cant blame you");
break;
}
break;
case "No":
alert("I suggest that you do");
var l1082 = prompt("So, are you going to change your mind?");
switch(l1082) {
case "Yes":
alert("Good, im glad to hear that");
break;
case "No":
alert("Ok, well, I cant force you");
var l1083 = prompt("You do know that its importent to know how to talk though, dont you?");
switch(l1083) {
case "Yes":
var l1084 = prompt("Ok since you think that, im going to ask you again, are you sure about yout disiscion?");
switch(l1084) {
case "Yes":
alert("Ok, ill stop bugging you");
break;
}
break;
case "No":
alert("Ok, well, I suggest you reconsider.");
break;
}
}
break;
}
}
}
break;
case "No":
alert("I dont know what to say to that");
var l22 = prompt("Are you just messing with me?");
switch(l22) {
case "Yes":
var l223 = prompt("I thought so, do you do this often?");
switch(l223) {
case "Yes":
alert("Well, Im not suprised");
break;
case "No":
alert("It seems like you know what your doing");
break;
}
case "No":
alert("Ok, well, im not going to argue with you");
break;
}
}
break;
case "3":
var yn3 = prompt("Can you crawl yet? Im not a parent");
switch(yn3) {
case "Yes":
alert("Nice");
var l33 = prompt("Is it fun?");
switch(l33) {
case "Yes":
alert("Im glad, I can understand why");
var l43 = prompt("Do you do it a lot?");
switch(l43) {
case "Yes":
alert("I bet");
break;
case "No":
alert("If its fun you should do it more");
break;
}
break;
case "No":
alert("Im suprised, I thought it would be fun");
break;
}
break;
case "No":
alert("Well, I hope your able to soon");
var l332 = prompt("Are you looking forward to being able to crawl?");
switch(l332) {
case "Yes":
alert("Ok, well, you just have to be patient");
break;
case "No":
alert("You should be, its fun");
break;
}
}
break;
case "4":
var yn4 = prompt("Can you walk yet?");
switch(yn4) {
case "Yes":
alert("Your parents must be exausted");
break;
case "No":
alert("Well, I think you will be able to soon");
break;
}
break;
case "5":
var yn5 = prompt("What is your favriot part about being 5? \"sleeping\", \"tv\", or \"other\"");
switch(yn5) {
case "sleeping":
alert("I loved sleeping a lot when I was a teenager, more then than now though.");
break;
case "tv":
alert("Cool, I love shows, I watch them a lot, a lot of tv");
break;
case "other":
alert(" like doing a lot of stuff");
break;
}
break;
case "6":
var yn6 = prompt("Is being that that age hard?");
switch(yn6) {
case "Yes":
alert("I hope it gets better, it was easy for me");
break;
case "No":
alert("Good, hope it stays that");
var l36 = prompt("Are you having a good time?");
switch(l36) {
case "Yes":
alert("Glad to hear it");
var l46 = prompt("Do you want to become older?");
switch(l46) {
case "Yes":
alert("Nice, you can do more stuff when you get older");
var l56 = prompt("Are you excited for the stuff you get when you get older?");
switch(l56) {
case "Yes":
alert("Nice, so was I");
break
case "No":
alert("You should be, its fun");
break;
}
case "No":
alert("Well, then you should enjoy it while you can");
var l562 = prompt("Do you know you get to do certain stuff when you get older?")
switch(l562) {
case "Yes":
alert("Ok, good");
break;
case "No":
alert("Well, you do, its fun");
var l662 = prompt("Do you know what kind of stuff?");
switch(l662) {
case "Yes":
alert("Ok, I guess you made up your mind");
break;
case "No":
alert("You should look it up");
break;
}
}
}
break;
case "No":
alert("Well, I hope it gets better");
var l462 = prompt("Are you making the best out of it?");
switch(l462) {
case "Yes":
alert("Great, glad to hear that");
var l562 = prompt("Are you going to keep trying your hardest?");
switch(l562) {
case "Yes":
alert("Good, you should, keep it up");
break;
case "No":
alert("You should, it will pay off");
break;
}
case "No":
alert("Oh, well, you should, it turns out good for you");
break;
}
}
case "7":
var yn7 = prompt("Have you had your birthday yet?");
switch(yn7) {
case "Yes":
var l471 = prompt("Did you have fun?");
switch(l471) {
case "Yes":
alert("Great, Im glad you did!");
var l571 = prompt("Are you looking forward to your next one?");
switch(l571) {
case "Yes":
alert("Good, I always do");
break;
case "No":
alert("Huh, I thought you would, I do");
break;
}
break;
case "No":
alert("Well, Hopefully you will next time");
break;
}
break;
case "No":
var l472 = prompt("Are you looking forward to it?");
switch(l472) {
case "Yes":
alert("Good, you will enjoy it.");
break;
case "No":
alert("You should be, you will have a great time!");
break;
}
}
break;
case "8":
alert("Thats when I met one of my best friends");
var l38 = prompt("Do you have a best friend?");
switch(l38) {
case "Yes":
alert("Good, its good having one");
var l48 = prompt("Have you been friends long?");
switch(l48) {
case "Yes":
alert("Nice, so have I with my friend");
break;
case "No":
alert("Well, hopefully you guys stay friends");
break;
}
case "No":
alert("Well, you should try and get one");
break;
}
case "9":
alert("I remeber being that age, thats when I went on my first rollercoaster");
var yn9 = prompt("Have you even been on a rollercoaster?");
switch(yn9) {
case "Yes":
alert("Nice, its fun");
var l39 = prompt("Did you like it?");
switch(l39) {
case "Yes":
alert("Nice, so did I");
break;
case "No":
alert("Well, mabey you will one day");
break;
}
case "No":
alert("You should, its fun");
break;
}
case "10":
var yn10 = prompt("Do you like being 10?");
switch(yn10) {
case "Yes":
alert("Cool, me to!");
var l310 = prompt("Do you have good friends?");
switch(l310) {
case "Yes":
alert("Good, so did I");
break;
case "No":
alert("Well, you should try and get some");
var l410 = prompt("Are you trying to get some?");
switch(l410) {
case "Yes":
alert("Good, keep trying!");
break;
case "No":
var l510 = prompt("Will you try and get some?");
switch(l510) {
case "Yes":
alert("Good, glad to hear it");
break;
case "No":
alert("Well, you should");
break;
}
}
}
case "No":
alert("Well, I hope it gets better!");
break;
}
break;
case "11":
var yn11 = prompt("How is being 11?");
switch(yn11) {
case "Good":
alert("Glad to hear that!");
break;
case "Bad":
alert("Im sorry to hear that, you just have to be strong!");
break;
}
break;
case "12":
alert("When I was that age I went to Flordia and had a great time");
break;
case "13":
var yn13 = prompt("Are you excited to be a teenager??");
switch(yn13) {
case "Yes":
alert("So was I!");
break;
case "No":
alert("Aw, it might be better than you thing though, so just hang in there!");
break;
}
break;
case "14":
alert("I remeber being 14, It was one of the best years of my life");
break;
case "15":
alert("Must be intresting for you, at that age you can get your drivers permit.");
break;
case "16":
var yn16 = prompt("Nice, So, are you happy to be driving?");
switch(yn16) {
case "Yes":
alert("I bet you are, so was I, I was really excited");
var l316 = prompt("Are you good at driving?");
switch(l316) {
case "Yes":
alert("Good, hope you have fun");
break;
case "No":
alert("Well, I hope you get better, it takes time");
break;
}
break;
case "No":
alert("Thats intresting, most people I meet really love driving");
break;
}
break;
case "17":
alert("Your almost an adult, be ready!");
break;
case "18":
var yn18 = prompt("Congratulations!, How do you feel?");
switch(yn18) {
case "Yes":
alert("Me to, It was one of the best days of me life");
break;
case "No":
alert("Thats a shame, but, it will turn out great!");
break;
}
break;
case "19":
var yn19 = prompt("What is your favriot part about being 19, \"Parties\", \"School\", or \"Friends\"");
switch(yn19) {
case "Parties":
alert("That was on of my favriot things");
break;
case "School":
alert("I did not really lke school that much, but it was nice");
break;
case "Friends":
alert("That, was my favriot part of bening that age");
break;
}
break;
case "20":
alert("I remeber those years, I was really busy then, but had a lot of fun");
break;
case "21":
alert("You can now drink, but be carefully!");
break;
case "22":
alert("At that age, you start to party");
break;
case "23":
alert("Collage really gets hard at that age");
var yn23 = prompt("Do you like collage?");
switch(yn23) {
case "Yes":
alert("I kind of did, I learned a lot");
var l323 = prompt("Are you having fun?");
switch(l323) {
case "Yes":
alert("Good, so did I, some of the time");
var l423 = prompt("Do you like it because of the parties?");
switch(l423) {
case "Yes":
alert("Im not suprised, thats one of the things lots of people like about collage");
var l424 = prompt("Is there anything else you like about collage?");
switch(l423) {
case "Yes":
alert("Well, thats good, it good to always have a backup thing you enjoy");
break;
case "No":
alert("Thats fine, but I suggest you find something else you like about collage incause parties dont work out for you");
break;
}
break;
case "No":
alert("Well, there are other ways to enjoy stuff, I liked parties");
break;
}
case "No":
alert("Well, you should try and have some fun, thats what I did");
var l4243 = prompt("Do you think mabey you will try some of the parties?");
switch(l4243) {
case "Yes":
alert("Good, I think you will enjoy them");
break;
case "No":
alert("I cant blame you, they can distract you");
break;
}
break;
}
break;
case "No":
alert("I can understand why, lots of people dont");
var l424 = prompt("Have you ever liked school?");
switch(l424) {
case "Yes":
alert("I never did either");
var l425 = prompt("Is school hard for you?");
switch(l425) {
case "Yes":
alert("It is for me to");
break;
case "No":
alert("Thats good, hopefully it stays that way");
var l426 = prompt("Do you think it will stay that way?");
switch(l426) {
case "Yes":
alert("I hope so to");
break;
case "No":
alert("I wouldnt be suprised");
break;
}
break;
}
break;
case "No":
alert("I understand, school gets harder the older you get");
break;
}
}
case "24":
alert("Well, nice to know more about you");
break;
case "25":
var yn25 = prompt("So, did you know your 1/4 of 100 years old?");
switch(yn25) {
case "Yes":
alert("Well, your not that old");
break;
case "No":
alert("Know you know, hope I didnt make you upset");
break;
}
break;
case "26":
alert("Ok, hope I get to know you more");
break;
case "27":
alert("Around that age I started to feel old");
break;
case "28":
alert("Around that time, I moved into a new house");
break;
case "29":
alert("I hope your having a good life, I am");
break;
case "30":
var yn30 = prompt("So, do you feel old?");
switch(yn30) {
case "Yes":
alert("So did I, but I was not really that old");
break;
case "No":
alert("Glad to hear that, took me a while to realise that");
}
break;
case "31":
alert("That is the age when I got a new job");
break;
case "32":
alert("Lots of people would love to be that young");
break;
case "33":
alert("Around this age, you have lots of more responsibiltes, so be carefull");
break;
case "34":
alert("That is when I started watching my favriot show, still watch it now");
break;
case "35":
alert("That is still pretty young");
break;
case "36":
alert("That, is when one of my friends started complaning about being old");
break;
case "37":
alert("That is the age of someone I know");
break;
case "38":
alert("Lots of people start to feel old at that age, but you really arent that old");
break;
case "39":
alert("Well, I remeber being that old, I had a lot of fun");
break;
case "40":
alert("That, is when I got a big promotion");
var lfourty = prompt("Have you ever got a promotion?");
switch(lfourty) {
case "Yes":
var lfourty2e = prompt("Did you like it when you got it?");
switch(lfourty2e) {
case "Yes":
alert("Same here, I loved it");
var lfourty3e = prompt("Are you hoping to get another one?");
switch(lfourty3e) {
case "Yes":
alert("Nice, so was I, I worked really hard");
break;
case "No":
alert("Some people just like there current job");
break;
}
case "No":
alert("Im suprised, most people do");
break;
}
case "No":
alert("Well, if you work hard, you might one day, thats what I do");
break;
}
break;
case "41":
alert("I started staying home at that age more");
break;
case "42":
alert("I liked being that age");
break;
case "43":
alert("That s when I met a great person, who is now my friend");
break;
case "44":
alert("I really started enjoying life at that point");
break;
case "45":
alert("I remember being that old");
break;
case "46":
alert("I did not socilize that much at that age");
break;
case "47":
alert("Ok, well, I hope you enjoy it");
break;
case "48":
alert("I had fun at that age");
break;
case "49":
alert("Wow, I remeber that, I was so upset to be that old");
break;
case "50":
alert("WOW, half a 100, I did not like that at all, but I got use to it");
break;
case "51":
alert("I really got worried at that age, that I was going to die, I was to worried");
break;
case "52":
alert("When I was that old I felt like I was getting very old");
case "53":
alert("That is when I bought a new car, the best one I have ever had");
break;
case "54":
alert("At that age, I started to feel tired a lot");
break;
case "55":
alert("Thats when I started to relize how old I was");
break;
case "56":
alert("This is when I retired");
break;
case "57":
alert("You might feel very old but you still have a lot of time left, even at that age");
break;
case "58":
alert("Ok, thanks for telling me");
break;
case "59":
alert("That is when I started relaxing");
break;
case "60":
alert("That is the age I started watching TV a lot");
break;
}
}