I'm a bit confused and lm eager to know where l got it wrong from my code


#1


var answer = prompt("What is you favourite subject?", "Type your choice here");

switch(Subject) {
case 'Maths':
console.log("I love working with numbers.");
break;

case 'English':
     console.log("I love reading stories.");
    break; 

case 'Geography': 
     console.log("I love nature.");
     break; 

default:
     console.log("The subject is not available as yet."); 
    break;

}


Replace this line with your code.


#2

Should be, switch (answer) {

Aside

Concerning prompt(). The second parameter is not meant as placeholder text, but a default return value if the user hits Enter without typing anything in the field.


#3

Thank you so much. I now understand the concept


#4

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