More on Control Flow 13/14


I got it right but I don't get why it works.

If it's asking me to make it so that the program returns true when programming is false, then shouldn't "!programming" = true? so it should return false instead of true?

programming = false
!programming = true
so shouldnt the code return false when plugging in "!programming"(true)?

// Declare your variables here!
var programming = false

var happy = function() {
  // Add your if/else statement here!
      return true;
      return false;



Programming is false, so if programming isn't true, (which it's not), happy will return true. I know it's a little bit crazy to understand, but that's just the logic of the program.


Went straight to bed after this lesson...


With my limited knowledge of JavaScript, I think the if statement is testing the condition. If the condition passes the test (Is programming false, true?) if yes, it will run the first return statement. I think that's what is happening. I think I just confused myself with this one. Okay, anyone else want to have a go at explaining this code? I would love to hear an expert try. I think I'm going to do what that other guy did. Go straight to sleep! Hahaha


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