Please Help -- Control Flow, Comparison Operators II

I am stuck in the Comparison Operators II exercise using === and !==.

How do I use === or !== here?

var moonPhase = 'full';
  if (moonPhase) {
  } else {
    console.log('I swear I am not a werewolf...')

Hi @pyninja25060,

Previously you learnt to check for a condition using comparison operators:

var hungerLevel = 10;

if (hungerLevel > 7) {   //<==== this condition evaluates to "true" because hungerLevel (10) is more than 7
  console.log('Time to eat!');
} else {
  console.log('Let\'s eat later.');

So for your case here, it’s the same thing. Simply substitutes the === symbol in replace of the > (comparision symbol), and the value of 7 with the value of you wish to compare.

Let’s say:

var favoriteFruit = 'Apple';

if (favoriteFruit === 'Apple') { //<== this compares if favoriteFruit is equal to 'Apple'
} else {
    console.log('I need my favorite fruit.');

Note: notice where you should place your ; semicolon as well.

Cheers! :slight_smile:


Thanks a lot! :slightly_smiling_face:


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