13/14 not


#1

I don't have any problems its just... this section is called not and I didn't use not and I still passed. How does it work?

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


#2

That's a pretty broad question, is there something particular that's eluding you?


#3

The if statement. I think codecademy meant to do if the programming was not true.


#4

false is not true, yes


#5

I'm a little curious as well, I mean i did it a different way compared to you but still managed to pass it so I'm more curious as to which is the correct or proper way to go about it. Either way both your code and mine still end up the same as false is not true. Here is my code:

var programming = false;

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

};

I can see how OP's code worked seeing as he set programming === false which in the end still made the if statement true but for learning purpose's on how this work I am curious to any feedback.


#6

i'm not sure it probably has to do with the '!'


#7

yeah I noticed your code doesn't have any ! (Not logical operator) but still passed it.


#8

I searched this link:
http://www.w3schools.com/js/js_comparisons.asp
and found out that ! is not. its like saying return not true and not false


#9

!true == false
!false == true
and i'm not sure that.
Booleans and opreator


#10

Yes that's exactly what it is :smiley:


#11

There's no need for an if-statement in this function. Return the result of an expresion instead.

return !programming

#12

you're getting a bug report,

the correct answer should be

!false

but you can get away with

true

So the assignment's purpose (to understand the logical operator not) is not neccesarilly fulfilled