Issue With Ceate Your Own Adventure


#1

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
The Lesson I Am Stuck On Is:
https://www.codecademy.com/courses/javascript-beginner-en-ZA2rb/0/6?curriculum_id=506324b3a7dffd00020bf661

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
The Code Runs Like MS = True Even When I Type Something Random Instead Of One Of The Options

```

var user = prompt("You Are Told You Have The Power To be A Mage! Do You Choose To Unlock Your Powers? ", “Type Yes No Or Maybe???”).toLowerCase();
switch(user){
case ‘yes’:
console.log(“Ok…Lets Continue”);
var MT = prompt(“What Type Of Magic Do You Want Unlocked”, “Offensive Defensive Or Utility”).toLowerCase();
if(MT === “offensive” || “defensive” || “utility”){
console.log(“Well Lets Get To It Then”);
var MS = true;
}else {
break;
var MS = false;
}
break;
case ‘no’:
console.log(“Well We Are Doing It Anyway…”);
var MT = prompt(“What Type Of Magic Do You Want Unlocked”, “Offensive Defensive Or Utility”).toLowerCase();
if(MT === “offensive” || “defensive” || “utility”){
console.log(“Well Lets Get To It Then”);
var MS = true;
}else {
break;
var MS = false;
}
break;
case ‘maybe’:
console.log(“Ok…Lets Get To It”);
var MT = prompt(“What Type Of Magic Do You Want Unlocked”, “Offensive Defensive Or Utility”).toLowerCase();
if(MT === “offensive” && “defensive”){
console.log(“Well Lets Get To It Then”);
var MS = true;
}else {
break;
var MS = false;
}
break;
default:
console.log(“Ok…We Will Ask Again!”);
break;
}
if(MS === true){
console.log(“Loading Level 1”);
var M1 = prompt(“You See A Dark Mage”, “Do You Attack, Run, Or Trick It”).toLowerCase();
}

<do not remove the three backticks above>

#2

@cloudrockstar23777,
Try it with

var user = prompt(
    "You Are Told You Have The Power To be A Mage! "+
    "Do You Choose To Unlock Your Powers? ",
    "Type Yes No Or Maybe???").toLowerCase();
switch(user){
  case 'yes':
    console.log("Ok....Lets Continue");
    var MT = prompt(
        "What Type Of Magic Do You Want Unlocked",
        "Offensive Defensive Or Utility").toLowerCase();
    if(MT === "offensive" || "defensive" || "utility"){
       console.log("Well Lets Get To It Then");
       MS = true;
    }else {
       MS = false;
       break;
    }
    break; 
  case 'no':
    console.log("Well We Are Doing It Anyway.....");
    var MT = prompt(
        "What Type Of Magic Do You Want Unlocked",
        "Offensive Defensive Or Utility").toLowerCase();
    if(MT === "offensive" || "defensive" || "utility"){
      console.log("Well Lets Get To It Then");
      MS = true;
    }else {
      MS = false;
      break;
    }
    break;
  case 'maybe':
    console.log("Ok...Lets Get To It");
    var MT = prompt(
        "What Type Of Magic Do You Want Unlocked",
        "Offensive Defensive Or Utility").toLowerCase();
    if(MT === "offensive" && "defensive"){
      console.log("Well Lets Get To It Then");
      MS = true;
    }else {
      MS = false;
      break;
    }
    break;
  default:
    console.log("Ok...We Will Ask Again!");
    break;
}
if(MS === true){
  console.log("Loading Level 1");
  var M1 = prompt(
      "You See A Dark Mage", 
      "Do You Attack, Run, Or Trick It").toLowerCase();
  }

closed #3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.