JavaScript Practice: Data Types, Conditional, Functions

Can anyone tell me what’s wrong with this page: JavaScript Practice: Data Types, Conditional, Functions ?

This page has 3 challenges to practise for javascript functions and conditions. In the first challenge my solution was:

function colorMessage (favoriteColor, shirtColor) {
  if (favoriteColor === shirtColor) {
   return 'The shirt is your favorite color!';  
  } else {
    return 'That is a nice color.';
  }
}

When i run it, it runs correctly with no errors but when i click “Check Answer”, the exercise tells me that my solution is wrong and says: “Oops! The test returned an error. Maybe you have a syntax error, or a typo. See full error.” . but I followed the instructions and did everything correctly and with no error at all and the console shows the right answer when running the code. and when i click “View Solution”, it writes this code:

// Create function below
let colorMessage = (favoriteColor, shirtColor) => {
  if (favoriteColor === shirtColor) {
    return 'The shirt is your favorite color!';
  }else {
    return 'That is a nice color.'
  }
}

did i go wrong or what???

1 Like

I think there is a bug with that colorMessage exercise. I reported it as a bug.

2 Likes