HELP! I have weeks and I cannot complete this


#1

Hi. I need some assistance for this level. I have weeks and I can not understand it.
var moonPhase = ‘full’;
switch (moonPhase) {
case 'full’
cosole.log(‘Howwwwlll!!’)
break;
case 'mostly full’
console.log(‘Arms and legs are getting hairier’)
break;
case 'mostly new’
console.log(‘Back on two feet’)
break
}

LEVEL


#2

Hi @bjeridefit55,

You’re missing something in the syntax, notably the colon : marks.

From the hint:

switch (moonPhase) {
  case 'full':        //<== Compare this to yours
    // run full code
    break;
  case 'mostly full':    //<== Compare this to yours
    // run mostly full code
    break;
  ...
}

It’s easy to overlook things. Make sure you follow the instructions very carefully and exactly by copying all the names and sentences to avoid spelling errors, then lastly check for syntax errors. Cheers :slight_smile:


Side Note:

If you still have some problems with that lesson, come back again and state in which step you are having trouble with and tell us what is the error the lesson is throwing.

Thank you pasting the lesson’s link. It helps. :+1:


#3

I do not understand very well english, so I would need some help. Thanks, but I have seen it, and I still do not understand it. :tired_face:


#4

Okay.
What precisely don’t you understand?
Be as specific as possible, so that we can better help you.


The general idea here is that:

  1. You first declare a variable, called moonPhase, and say that it’s full. This just states that the Moon is full.
  2. But the Moon is not always full. Sometimes it is full, sometimes partly full, etc.
  3. We will evaluate each situation, and what happens when the Moon is full, or partly full, etc.
  4. To evaluate each situation, better known as case, we use what we call a switch.

In the case that the moon is full, we will display “Howwwwllll!”.

case 'full':
console.log('Howwwwlll!!');

If, however, the moon is only partly full, we will display another message.

case 'mostly full':
console.log('Arms and legs are getting hairier');

And we simply do this for each case. Each situation, or case, has a consequence. The consequence is the message that we display (“Howwwll”, or “Arms and legs are getting hairier”, etc).

Then, when we go back to our moonPhase variable, if we change its value (from full to mostly full, for example), the text displayed on the console will change, based on the instructions given in the switch.


/!\ Beyond this logic, you need to be very careful with the syntax of your code. /!\

You forgot colons ( : ) after stating each case, and you use different types of quotes as well (sometimes ' , sometimes . These are not the same, so try to be consistent and use ' only.


Hope this helps. Otherwise, try explaining what it is you do not understand, and we’ll try to help differently.

Also, what language do you speak?


#5

Thanks. BUT I really need this exercise done. I speak Albanian and a little Greece.

Then, write each else if condition as a case.
If moonPhase is ‘full’, then use console.log to print ‘Howwwwlll!!’.
If moonPhase is ‘mostly full’, then use console.log to print ‘Arms and legs are getting hairier’.
If moonPhase is ‘mostly new’, then use console.log to print ‘Back on two feet’.
Remember to add a break after each console.log, like in the example in the instructions.

Hint

switch (moonPhase) {
case ‘full’:
// run full code
break;
case ‘mostly full’:
// run mostly full code
break;

}

I DO NOT UNDERSTAND THE HINT AND THE SECOND TEST
I do not want the answer, but the explain of HOW TO COMPLETE THE LEVEL. I REALLY DO NOT GET HOW TO COMPLETE IT.

HEEEEEEELP:persevere:


#6

You’re also doing an older version of the course, which I believe isn’t supported anymore.

You might run into bugs and whatnot, and possibly won’t be able to complete it.

I’d advise you to start over and take this course instead:

https://www.codecademy.com/learn/introduction-to-javascript


#7

OK. I am going to try that one. Thanks. I really appreciate everyone helps.


#8

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