Having issues with my function not working on javascript. Says my function is not a function -
i making text based rpg , decided use functions instead of repeating sake of convenience. have have made 3 far, 1 intro, 1 ending, , 1 picking shoes wear (which contains ending). opening , ending work, , shoes work well, put rest of game, shoes function not work. says "typeerror: shoes not function". made sure formatted same other functions, still not work. here include link have far on google docs. shoes function third function listed. works using code academy because using console. run go second link , hit save , submit. when asked question type first option listed in // have not yet finished others. https://docs.google.com/document/d/1pgqnfncxsngxkp43mulozh3w2xedld8nq-knluhsq_8/edit?pli=1
var opening = function (opening) { console.log ("you looking @ ceiling."); console.log ("you feel sun shining on through bedroom window."); console.log ("you on @ clock. 10:37am."); console.log ("you contemplate getting out of bed."); var wakeup = prompt ("get out of bed? /yes/ or /no/?"); if (wakeup == "yes") { //1 alert ("you decide out of bed."); console.log ("……………………………………………………………………………………………………"); console.log ("……………………………………………………………………………………………………"); console.log ("……………………………………………………………………………………………………"); console.log ("……………………………………………………………………………………………………"); console.log ("……………………………………………………………………………………………………"); console.log ("you , @ in mirror."); var usersex = prompt ("are male or female?"); var userhaircolor = prompt ("what color hair?"); var userhairlength = prompt ("how long hair?"); var usereyecolor = prompt ("what color eyes?"); var userskintone = prompt ("what skin tone?"); var userglasses = prompt ("do wear glasses?"); console.log ("before head out want check computer , freshen up."); } } //////////////////////////////////////////// var ending = function (ending) { var endingaction = prompt ("are ready go outside? /yes/ or /no/?"); if (endingaction == "yes") { //15 alert ("you open door , walk outside , go day."); } else if (endingaction == "no") { alert ("you remember lazy couch potato , go inside , watch t.v.."); } } //////////////////////////////////////////////// var shoes = function (shoes) { var shoechoice = prompt ("what shoes wear? /sneakers/ or /sandals/?") if (shoechoice == "sneakers") { //14 console.log ("you grab socks , pair of nike sneakers , put them on."); console.log ("you up, make sure ready, , put hand on door handle."); ending("ending") } else if (shoechoice == "sandals") { console.log ("you slip on pair of blue sandals , walk door."); ending("ending") } } ////////////////////////////////////////////////// / ///////////////////////////////////////////////// alert ("begin?"); opening("opening") var beforeheadingoutaction = prompt ("do want /check computer/ or /freshen up/ first?") if (beforeheadingoutaction == "check computer") { //2 alert ("you decide check computer."); console.log ("……………………………………………………………………………………………………"); console.log ("……………………………………………………………………………………………………"); console.log ("……………………………………………………………………………………………………"); console.log ("……………………………………………………………………………………………………"); console.log ("……………………………………………………………………………………………………"); console.log ("you head on desk."); var usercomputer = prompt ("do have /desktop/ or /laptop/?"); if (usercomputer == "desktop") { //3 alert ("you sit down @ desk , boot computer."); console.log ("the computer logo pops , after few seconds , login screen appears."); console.log ("you enter password , login."); console.log ("you notice have 2 facebook notifications"); var checkfacebook = prompt ("do want check facebook? /yes/ or /no/?"); if (checkfacebook == "yes"); { //4 alert ("you click on tab facebook open."); console.log ("……………………………………………………………………………………………………"); console.log ("……………………………………………………………………………………………………"); console.log ("……………………………………………………………………………………………………"); console.log ("……………………………………………………………………………………………………"); console.log ("……………………………………………………………………………………………………"); console.log ("you see have 1 message , tagged in 1 photo."); var firstfacebookaction = prompt ("do want /check message/ or /check photo/ first?"); if (firstfacebookaction == "check message") { //5 alert ("you open messages."); console.log ("you see message friend met other day."); console.log ("he asked if wanted lunch him on monday."); console.log ("'hey had fun hanging out other day , wanted know favorite food was?'"); var favfood = prompt ("what favorite food? (plural)"); console.log ("'my favorite food " + favfood +".'"); var favfoodplace = prompt ("where " + favfood + "?"); var lunchplans = prompt ("do want go " + favfood + " at" + " " + favfoodplace + " sometime next week? /yes/ or /no/?"); if (lunchplans == "yes") { //6 console.log ("'cool, i'll call later when find time works.'"); alert ("you respond yes smiley emoji."); console.log ("…………………………………………………………………………………………………"); console.log ("…………………………………………………………………………………………………"); console.log ("…………………………………………………………………………………………………"); console.log ("…………………………………………………………………………………………………"); console.log ("…………………………………………………………………………………………………"); console.log ("you bye , close out of chat."); var aftermessageaction = prompt ("do want /check other notification/, or /log off/ computer?"); if (aftermessageaction == "check other notification"); { //7 alert ("you check other notifications."); console.log ("you click on 'notifications' , see tagged in photo friends @ local pizza place hangout at."); console.log ("you chuckle remembering when friend tried eat whole pizza in under 5 minutes."); alert ("you photo , close out of facebook."); console.log ("…………………………………………………………………………………………………"); console.log ("…………………………………………………………………………………………………"); console.log ("…………………………………………………………………………………………………"); console.log ("…………………………………………………………………………………………………"); console.log ("…………………………………………………………………………………………………"); console.log ("you glance down @ time , see 10:59."); alert ("you decide log off computer , head bathroom ready day."); console.log ("you bathroom , feel difference in temperature warm sunbathed room cold bathroom"); console.log ("you shuffle on corner bath , shower located."); var bathorshower = prompt ("do want take /shower/ or /bath/?"); if (bathorshower == "shower") { //8 alert ("you opt shower instead of bath."); console.log ("you hop shower , turn on water."); console.log ("you feel refreshed , glad started taking 2 showers day."); console.log ("…………………………………………………………………………………………………"); console.log ("…………………………………………………………………………………………………"); console.log ("…………………………………………………………………………………………………"); console.log ("…………………………………………………………………………………………………"); console.log ("…………………………………………………………………………………………………"); alert ("after fifteen minutes out of shower"); console.log ("you step out , wrap in towel after drying off."); console.log ("you relax minute or 2 before getting dressed."); console.log ("today august 23 , weather temprate cool breeze see after check weather app."); console.log ("you decide wear t-shirt because bought bunch of new ones online."); var tshirtstyle = prompt ("do want wear /graphic/ or /plain/ shirt?"); if (tshirtstyle == "graphic") { //9 var graphictshirtdesign = prompt ("what on shirt?"); console.log ("you put on shirt " + graphictshirtdesign + " design."); console.log ("it not yet cold outside, not warm cannot wear on shirt."); var overshirt = prompt ("do want wear on shirt? /yes/ or /no/?"); if (overshirt == "yes") { //10 var overshirtchoice = prompt ("do want wear grey /sweater/, blue /hoodie/, or black /jacket/? or did /change mind/?"); if (overshirtchoice == "sweater") { //11 console.log ("you take sweater off hanger , put on."); console.log ("you open part of wardrobe shorts , pants."); var bottomwear = prompt ("do want wear /pants/ or /shorts/?"); if (bottomwear == "pants") { //12 var pantstype = prompt ("what type of pants want wear? /sweatpants/ or /jeans/?"); if (pantstype == "sweatpants") { //13 console.log ("you grab pair of white sweatpants , put on decide should buy pair or two."); console.log ("you don't feel wearing else head on front door."); console.log ("you open shoe closet , ponder footwear options."); shoes("shoes") } } } } } } } } } } } }
i not getting errors code.
also, should format code better clear view , find probable errors.
i advise trying run code outside code academy (jsfiddle maybe?) avoid interference. try , update happened (and link fiddle).
anyway, 2 things can fix in code:
this line:
////////////////////////////////////////////////// / /////////////////////////////////////////////////
if want have this, adjust be:
////////////////////////////////////////////////// //////////////////////////////////////////////////
and ;
missing (probably not reason error, adjust code)
Comments
Post a Comment