Confusion about using ‘or’ and ‘not’ operators


Here is the code in section 10: Overview -

// Complete lines 3 and 4!

var iLoveJavaScript = true;
var iLoveLearning = true;

if(iLoveJavaScript && iLoveLearning) {
  // if iLoveJavaScript AND iLoveLearning:
  console.log("Awesome! Let's keep learning!");
} else if(!(iLoveJavaScript || iLoveLearning)) {
  // if NOT iLoveJavaScript OR iLoveLearning:
  console.log("Let's see if we can change your mind.");
} else {
  console.log("You only like one but not the other? We'll work on it.");

What I understood from the else if statement in line 9

else if(!(iLoveJavaScript || iLoveLearning))

If I don’t like iLoveJavaScript or if I don’t like iLoveLearning then run the else if code.
Here, I thought and is more appropriate. Because, end of the day, else if code should be executed only if the user doesn’t like both iLoveJavaScript and iLoveLearning.
Please correct me if my understanding is incorrect.


Yes, only if both are false.


Can you please elaborate.
Are you concurring with what I am saying?


If both are true, the if will run; if both are false, the else if will run; if one is true, the else will run.


I understood that point...
What I did not understand is why Code Academy used 'or' operator instead of 'and'.

Please read my original question / post before responding.


Lol I did,

They used both sir.


They used OR

else if(!(iLoveJavaScript || iLoveLearning))

can someone please help me?

T && T => true
T && F => false
F && T => false
F && F => false

T || T => true
T || F => true
F || T => true
F || F => false

When the expressions are grouped, NOTting them reverses the outcome.


Thanks for clarifying..... I guess whenever I am confused about some issue, I should return to basics.