+ 1
Is it possible to have more than one "else if" conditional statement in the same script. Even tried this code didn't work.
var x = 1 If (x == 1) { document.write("joy) } else if (x == 2) { document.write("love") } else if (x == 3) is { document.write("peace") } else { document.write ("health") }
3 Answers
+ 2
Yes, it's possible, you've just made a lot of syntax errors:
line 2, if has a capitalized "i";
line 3, you forgot to close the string with the double quotes;
line 8, unnecessary "is" word.
You're also forgetting to end statements with semicolons (' ; ').
+ 1
Hi there,
Just one question. Is it not printing joy out?
It won't print love, peace, or health out because you're not changing the amount of "x", but if it's not working at all, try using print("joy");
You also need a semicolon (;) at the end of your document.write.
Hope it helped!
+ 1
Thanks guys
Did helped