Logical Operators


#1

<Hi Guys, can you help me out? I’m stuck in number 1 activity of Logical Operators>

Let’s say the werewolf can only become its wolf form when there is a full moon and a it’s a foggy night.

We already have a moonPhase variable, so let’s start with making a isFoggyNight variable set equal to true.

<Below this line, add a link to the EXACT exercise that you are stuck at.>
let moonPhase = ‘solar eclipse’;

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
should i add the isFoggyNight like this? let isFoggyNight = true;

```

let moonPhase = ‘solar eclipse’;

if (moonPhase === ‘full’) {
console.log(‘Howl!’);
} else if (moonPhase === ‘mostly full’) {
console.log(‘Arms and legs are getting hairier’);
} else if (moonPhase === ‘mostly new’) {
console.log(‘Back on two feet’);
} else {
console.log(‘Invalid moon phase’);
}

<do not remove the three backticks above>

#2

yes, you should. Why do you doubt this? Declaring variable is something you learned sometime ago


#3

Here is a quick reference for let and const, while they are used under different conditions, they are applied to the code the same way :wink:

https://medium.com/javascript-scene/javascript-es6-var-let-or-const-ba58b8dcde75


#4

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