+ 1
Where I'm doing wrong?
3 odpowiedzi
+ 6
Hello, Abhishek Singh !
Your mistake was that you specified your value without quotes, without quotes, javascript, recognizes as another variable and looks for it
var color = "yellow";
if (color == "blue") {
document.write("This is blue.");
} else if (color == "red") {
document.write("This is red.");
} else if (color == "green") {
document.write("This is green.");
} else if (color == "orange") {
document.write("This is orange.");
} else {
document.write("Color not found.");
}
+ 1
Alexander Sokolov ohh Thank you bro🙏
0
You should put "yellow" into brackets. Without brackets, interpretator thinks, that yellow is another variable and, because it is not defined, sets color to undefined too.