5/6 Logical Operators


Add some if/else statements to your cases that check to see whether one condition and another condition are true, as well as whether one condition or another condition are true. Use && and || at least one time each.

var user = prompt("What is your favorite color?").toUpperCase();

switch(user) {
case 'red':
if(red && blue = true) {
console.log "The 4th of July colors"
else {
console.log "These are other colors that have nothing to do with the 4th of July, unless it is white."
console.log("You like the color of strawberries.");
case 'blue':
console.log("You like the color of the sky.");
case 'pink':
if(pink || red = true) {
console.log "Those are Valentine Day colors."
else {
console.log "These colors have nothing to do with Valentine's Day."
console.log("You like the a girly color.");
console.log("You like other colors of the rainbow.");

ReferenceError: Invalid left-hand side in assignment

What is wrong with my code?


Well, I just want to say this:

This is a function that changes the answer into upper case. Which means:

Probably should turn those capitalized. Also:

To make these work:

You should probably make another prompt to make it work.


What should the extra prompt look like or include?


Something like:

var redBlue = prompt("Do you like RED and BLUE?").toUpperCase();
if(redBlue === 'YES'){}

var pinkRed = prompt("Do you like PINK or RED?").toUpperCase();
if(pinkRed === 'PINK'){}
else if(pinkRed === 'RED'){}