Logical Operator 'Not', Lesson 13, having a challenge


#1

Need help! My code looks right, but it keeps telling me 'syntax error'.
(Instructions: Declare a variable called programming and set it to false. Then, write an if/else statement inside happy so that happy returns true if programming is false and false otherwise.)

Here's my code:

var programming = false;

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

I've tried changing this a number of times, but it's always wrong! I know it's something very simple..


#2

here you have 2 values (programming and !false) but no operator in between that tells the interpreter what to do with these values.

PS: in case you wanted to say if programming is not equal to false, then you missed the equal sign :wink:


#3

Thanks! All I needed was that equal sign :slightly_smiling:


#4

I have the same exact code with an equal sign but it still says it's wrong!


#5

Then you're problem is something else and you should post your code in a new question thread because it most likely will not be the same but just similar.


#6

you dont need to put pragramming === to false.... just wirte (programming)... it'll check it... because when you declare some variable = false... it means it is false...


#7

you have to put the ! in front of the word programming and then it will work


#8

Thanks! I was so stuck on the !true that I forgot to apply the recipe to the variable!