Exercise about IF condition

Hi, I’m new here and I am learning Javascript.

The exercise is the following:

"Create an if statement that will evaluate if the weather is rainy and you’re feeling happy. If so, in the code block of the if statement, print the string “I am singing in the rain, just singing in the rain!”.

Here is my code:

var weather = 'rainy';
var isHappy = true;
if (weather === 'rainy') if (isHappy = true){ console.log("I am singing in the rain, just singing in the rain!") };

But it gives me back:

Code is incorrect
You should check weather and isHappy in your condition

What am I doing wrong?

I see two issues. First, this is the assignment operator instead of the comparison operator. Second, from that error message you may need to use the logical and operator.

Is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.


So what is the correct answer? Help pleaseeee

If you have a question about a specific challenge as it relates to your written code for that challenge, just click the Ask for Help button located on the challenge. It will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.