--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
It shows -Uncaught SyntaxError: Unexpected token else
Also, running it without that semicolon -<!DOCTYPE HTML>
Hi there.
This is not the usual thing to ask here (I’d go for some sort of Javascript forum in the future).
I think you don’t need to include any sort of HTML here to get ppl to look at your JS.
First problem:
You have a ; after the end of your if block (I’ve marked it below), that ends the if else statement too early. Else cannot stand alone so to speak.
Second problem: your blocks are not entirely right here. The parser can only follow the rules here. The if sentence either deals with the next statement (line) or block. Only if that line or block is directly followed by an else or else if can that be included. A corrected (untested assumption here) example could be (there is more than one way to do it):
var a = “0”
var b = “c”
if (a == “0”)
{
if (b == “b”)
{
alert(“a is o”);
alert(“b is b”);
}
}
else
{
alert(“a is not o”);
}
/Mikael
When I try this code -
<!DOCTYPE HTML>
<html>
<script>
var a = "o";
var b = "c";
if (a == "o")
if (b == "b")
{
alert("a is o");
alert("b is b");
}; ß Problem here
--