Well I think I am placing the || and && in the wrong lines


#1


#2

This,
(user === 'Richard' || 'Rich')
Will not compare 'Rich' to user

Consider:

console.log(false || 'beepboop')


#3

Why not? I'm using the code it stated. I have opening and closing brackets..Using (false || 'beepboop')..is not in the description..


#4


#5

It's not in the description, but what do you think it prints? If the first comparison turns out as false, then you get something similar to that.

You fixed it in the screenshot.

You might want to print out the value of user just before your switch, the switch will only enter cases with an exact match.

Also, user can't be both 'chuck' and 'chucky' at the same time.
And if the switch has already matched on 'Richard', then user will not be 'Rich', it'll be 'Richard', otherwise you wouldn't be in that part of the switch.


#6

I DID though! That is the thing, heh. I entered 'Rich" (without the quotes, of course)


#7

Sure, but that's not the value that user has before the switch is entered. You changed it to something else first.

print out user and see what it is before entering the switch.


#8

So you have to prompt again in the if/else statement? I tried printing again and I just kept on getting the same result. I really want to know how to get it to do exactly what I want. I'm soooo confused..


#9


#10

It does exactly as told.

You told it to make the input all upper case. None of your cases are all upper case, so none of them match.

Printing user before entering the switch would tell you that it is upper case.


#11


#12

...Do you have any cases that are all lower case?


#13

Still not calling the extra questions...


#14

If you enter Richard, then you change that to 'richard' and there's no such case.
the charles case is lower case, so that'll match.

Extra questions? You mean the ones where it tests if user is something other than the case? It won't be, because then you wouldn't be in that case.


Unexpected token 5/6 (Code your own adventure)
#15

Basically, once you've defined that all user answers will be converted .toLowerCase, then you should be writing all your cases in lower case too.

Do you understand what a case is? It anticipates a situation where your user inputs whatever answers you prompted them to.

They might enter their input in any case combination, like "richard" or "RICHARD" or "RiCHard" etc. This is messy with too many possible variations. By adding .toLowerCase converter after the prompt(), you are converting their answers into a defined case format, (ie: now *"RiCHarD" becomes "richard") for your convenience.

Thus you should be writing:

case "richard":
console.log("Srsly.");
break;

case "charles":
console.log("Totes.");
break;

case "cody":
console.log("Yo.");
break;

Also, you can suggest options that will appear inside the pop-up prompt's input bar by adding them after your question, separated by a comma, like this:

var user = prompt("What's your favourite drink?", "Coffee, tea, beer, juice or soda?").toLowerCase;

Try it! This is a good idea since you're only coding for a limited number of expected answers.