5 else if


#1

var moonPhase = 'full' {

} else if ('mostly full'===moonPhase)
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')
}


Set moonPhase to 'mostly full' and run your code.

We expect 'Arms and legs are getting hairier' to log to the console.

do not understand

help me,guys


#2

Right now you have a variable name 'moonPhase' set to 'full'. Change it so it
is set to 'mostly full'.


#3

Can you edit by my code above?


#4

You have the variable moonPhase, which is equal to the string "full".

var moonPhase = "full";

Your if/else statement is going to check your variable and respond based on what moonPhase equals:

/*checks if moon phase is equal to full*/
if (moonPhase === "full") {
  /*if moonPhase equals full, it logs the following:*/
  console.log("moonPhase equals full");
/*If moonPhase does not equal full, it will check to see if it is equal to mostly full.*/
} else if (moonPhase === "mostly full") {
  /*Again, if it equals mostly full, it will log the following statement: */
  console.log("Arms and legs are getting hairier.");
}

So what you are going to need to do is change the value of the variable moonPhase, so that it will equal the appropriate string that will return the response Codecademy is expecting to see.


#5

I still can not, please, it's hard to understand. If you can show me the code already here, I would greatly appreciate it.


#6

@byteninja91365 Posting code answers is not allowed on these forums. If you can't understand @spiderpiggie's answer, I'd recommend restarting the course to better learn how JS works :slight_smile:


#7

It's serious? I'm asking for help, bro.


#8

@byteninja91365 No, you're asking for the solution. You already got help. What was confusing about Shawn's answer? Maybe he or I could explain it a little better.


#9

For example,I want to understand why I can not hit the code, I can not seem to figure out where to get mostly full. I do not know if it is in the variable or if it is in the commands below


#10

@byteninja91365 To get the else if statement to run, you'd set the moonPhase variable to "mostly full". The commands below are only checking what the variable has set as its value. Their job is to tell you what it is, not change it in any way :slight_smile:


#11

var mostly full = "full";

if (moonPhase === "full") {

console.log("moonPhase equals full")

} else if (moonPhase === "mostly full") {

console.log("Arms and legs are getting hairier.");
}

BROTHER,I can not, please correct my mistake,bro, I no longer know what to do and I'm already discouraged. Help me please!!!!!! :cry: :sob:


#12

@byteninja91365 Your problem is on the first line:

var mostly full = "full";

Make the variable be called moonPhase, then set it to whatever you want inside the quotes:

var moonPhase = "full";
// or
var moonPhase = "mostly full";

#14