Lesson 13 - Not


#1


https://www.codecademy.com/courses/javascript-beginner-en-qDwp0/2/4?curriculum_id=506324b3a7dffd00020bf661#


Code works. I don't get how this is correct, though. If:
var programming = false (as defined per instructions) and we want to return 'true' if programming is false,

shouldn't it then be
var happy = function () {
if (programming) {
return (!false);

?


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


#2

You code is correct. But as for me this version is not readability, better is:

  if (!programming) {
      return true;
  }
  else {
      return false;
  }

So, if programming is not true return true otherwise false.
But it's only for me. The goal of this lesson is to use logical operator not and understand how it works.


#3

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