Capital letters in a switch code


#1

Hi everyone,

I was wondering how to make the program recognize a word with a lower case and capital letter.

For instance, my switch code below includes the book "Fifty shades of grey" with an F. If i type f, the program won't recognize the title of the book. How could I remedy that ?

Thx

var answer = prompt("What is your favorite book?");

switch(answer) {
case 'The old man and the sea':
console.log("Nice choice!!");
break;
case 'Quo vadis':
console.log("Woau, impressive! Not a lot of people know that book!");
break;
case 'Fifty shades of grey':
console.log("You're such a pervert!");
break;
default:
console.log("I don't believe this is a book!");
}

#3

Hi,

Interesting question :slight_smile:
This will be covered in the next section :arrow_right: Choose Your Own Adventure 2!

So you will learn it soon, how to convert to uppercase and lowercase


#4

Perfect ! Thank you a lot


#5

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