Javascript


#1

Hi, someone can tell me why this exercise is wrong? Thanks

2.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.

var moonPhase = 'full';

switch (moonPhase) {
case 'full' :
console.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;

default:
console.log('Invalid moonPhase');
break;

}


#2

because they told you to use if and elif statements and you're using a switch/case statement


#3

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