Unknown error on my challenge, help

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!”.
This is my challenge, i have created the following code:

var weather = 'rainy';
var isHappy = true;

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

but when i execute it, it says code incorrect unknown error, how can i solve this? thank you for your help

How are you running this code exactly? What says “code incorrect unknown error”?

I think its a IDE created for a introdutory course on Java, but I am stuck on this particular challenge and it just always says the same thing when i execute it

Java and JavaScript are not the same thing at all. You can not expect to run JavaScript in a Java IDE.

i assumed “introdutory” said everything, thank you non the less for your help

Hey! Bro, you did not use { } brackets in if else statement.

i also give you a code with a proper way.

var weather = ‘rainy’;
var isHappy = true;

if(weather === ‘rainy’ && isHappy === true){
console.log(“I am singing in the rain,just singing in the rain!”);
}else{
console.log(‘’);
}


Nice to Meet You.

Brackets are not required. The code is perfectly valid JavaScript as written.

you know what, it was actually the brackets, thank you so much bro, something so simple, yet i tunneled so hard on the “unknown error” that i just didnt even second guess it

The IDE you are using must not be very robust as not using brackets should not affect the execution of the code. Anyway, glad you were able to get something working. However, if you are taking a course with such an IDE, I would recommend finding another online JavaScript course (like freecodecamp.org) and stay away from a course that does not allow you to write valid JavaScript to solve the problems.