More on control flow in js Not


#1

Hi all, I'd like to know what's wrong with my code, if anyone can help i'd be very grateful :slight_smile:

var happy = function() {
if (programming = !true) {
return !false;
} else {
return true;}

};

The error i'm receiving says " Oops, try again. It looks like your happy function returns true instead of true when programming is true"


#2

Hi this line

if (programming = !true)

change the = with ===


#3

Hi, thanks for the reply, apparently this other way of writing the code worked for me

var programming = false

var happy = function() {
if (programming) {
return false;
} else {
return !false;
}

};

very strange eh?