5. Logical Operators


what is wrong with my code?

var user = prompt("Do you enjoy Deez Nuts?").toUpperCase();

switch(user) {
case "YES":
console.log("Give this man a beer.");
var type = prompt("Corona or Budlight?").toUpperCase();
var types = prompt("Coster?").toUpperCase();
if(type = "YES" || types = "YES") {
console.log("Thanks, for the positive feedback.");
} else {
console.log("I'll get right on it");
case "NO":
console.log("No beer for you.");
case "WHAT":
console.log("Don't be playin games with me.");
var explain = prompt("You have hearing aids?").toUpperCase();
var explains = prompt("Are you tired?").toUpperCase();
if(explain = "NO" && explains = "NO") {
console.log("I don't understand people like you.");
} else {
console.log("Ok, I'll give you a break.");

  console.log("I don't understand the answer" + user + "try again");



Line 12 & 25: Replace every "=" with "==".

The "=" operator is an assigment operator. It sets a value to what is left to it.
The "==" operator is a comparison operator. It compares the value on it's left with the value on it's right.

Another operator similar to "==" is the "===" operator.
"==": Cares just for the value.
"===": cares for the value and the type.

More on operators: http://www.w3schools.com/js/js_operators.asp


So I should replace all the = with == for lines 12 through 25?


Never mind I got it, I had to replace all the = with == for the statements with the || and && operators.