Hello. I am stuck at this exercise and I really need help.
“Take the if statement you created and add an else statement. Inside the code block of the else statement, console.log() a string.”
- var weather = ‘rainy’;
- var isHappy = true;
- if (weather === ‘rainy’ && isHappy === true) {console.log(‘I am singing in the rain, singing in the rain!’);} else {console.log();}
the output is:
Code is incorrect
Make sure you are printing the expected string
What am I supposed to write after the else statement? Help pleaseeeee
Hello, @yocanafeijo345477112, and welcome to the forums.
Difficult to say what the exact issue is without a link to the exercise, but make sure your printed string is exactly the same as what is asked for in the instructions.
Hi @yocanafeijo345477112
Your logic in this exercise is correct, however you need to specify strings with either; single quotes ( ’ ’ ), double quotes ( " " ) , or backticks (
).
What you used were quotation marks.
var weather = 'rainy';
var isHappy = true;
if (weather === 'rainy' && isHappy === true) {
console.log('I am singing in the rain, singing in the rain!');
} else {
console.log();
}
This is exactly the same code logic, just changed the marks to single quotes. I hope this helped!
w3schools strings