Capital letters in a switch code


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 ?


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

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



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


Perfect ! Thank you a lot


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