If else statement

In this chapter whenever according to the chapter {https://www.codecademy.com/courses/learn-javascript/lessons/control-flow/exercises/comparison-operators-ii?action=lesson_resume&link_content_target=interstitial_undefined}
here it was always if statement run whether i change the value from full to any other like half or any other string but its o/p always shows “Howllll!!!” but i can’t run the else statement. pls suggest some instructions so i can run the else part here is my code::

var moonPhase = “full”;
if (moonPhase = “full”) {
} else {
console.log(“I swear I am not a warewolf…”);

If you if-statement always picks the same branch, then that says something about the condition you’re using.
So how does one test if two values are equal?


Hi @webace18314 ,

You forgot to write “if (moonPhase === ‘full’”! I am almost sure that’s the problem. I have made this mistake too. I hope that this helps.

1 Like

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