8/14 Error: Make sure you have a break statement for each case


#1

var daddy = prompt("Who is your daddy?", "Write the name of your father.")

switch(daddy) {
    case 'Adam':
      console.log("In the case of young Jordan, Adam you are not the father!");
      break;
    case 'Jason':
      console.log("In the case of young Tyrone, Jason you are the father!");
      break;  
    case 'Maurice':
      console.log("In the case of young Peanut, Maurice you are the father.");
      break;
    case 'Sam':
      console.log("In the case of young Samuel, Sam you are the father.");
      break;
    default:
      console.log("I'm sorry I don't know who your " + daddy + " is, but Murray will work hard to find out!");
}

I'm trying to figure out if there is a bug with the console. Because the code I have is correct especially for the error is talking about. I placed this exact code in the lesson just prior to it and everything went fine. But on lesson 8/14 it gives the error in the description. Any thoughts?


#2

Ok so I finally solved the issue which it turns out is not the issue as described by the console. The issue was that too many words were used in the console.log command. I'm not sure if this is specific to code academy's console because I know its very strict in odd areas when you write code but under normal conditions the code is correct and works fine.

But if you do a console.log("Whatever you want to say here") command you must make sure to limit the amount of characters you use in your sentence or it throws up an error like the one I had.

At least for lesson 8 "All on your own", using the original code on the previous lesson and the next that follows lesson 8, it gives it the pass with no errors to report.

So someone on the staff team should give it a look-see.


#3

Hey I had the same problem but still after making the text shorter it gives me the same error, I do not understand what I did wrong, If you can send me the working code I would be glad.


#4

var daddy = prompt("Who is your daddy?", "Write the name of your father.");

switch(daddy) {
    case 'Adam':
      console.log("Adam you are not the father!");
      break;
    case 'Jason':
      console.log("Jason you are the father!");
      break;  
    case 'Maurice':
      console.log("Maurice you are the father.");
      break;
    default:
      console.log("I'm sorry");
      break;
}

Hey sorry it took so long to get back to you I have been away for a while. I hope you have your answer already, but just in case this is my code. Hope it helps for you to compare to.