13. Not false/true



I get the following error "Oops, try again. It looks like your happy function returns true instead of true when programming is true". This sounds like my code should be accepted. Please help.

// Declare your variables here!
var programming = false

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


the program should return true when the if clause execute:

if (condition){
  return true

to compare you should use two equal signs, not one (one equal sign means assign)


2 Things

  1. If (programming = false)
    is the same thing as

if (!programming)

which this lesson is trying to teach using the ! operator
//remember less code is best code

  1. The instructions say to "return true, when programming is false."
    So In your example

return programming // returns false

We want it to return True, as per the instructions

To change that you can do:
return true; //instead of return programming

It is a bit confusing when trying to learn, I got stuck for a bit as well.


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