I have some questions and need some clarifications.

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");
 };
else
{
 alert("a is not o");
};
</script>
</html>

It shows -
Uncaught SyntaxError: Unexpected token else

Should that error be triggered? can you explain why?



Also, running it without that semicolon -
<!DOCTYPE HTML>
<html>
<script>
var a = "o";
var b = "c";
if (a == "o")
 if (b == "b")
 {
  alert("a is o");
  alert("b is b");
 }
else
{
 alert("a is not o");
};
</script>
</html>

Shows an alert - "a is not o".
As far as I know, "if" and "else" count as two statements. If they are, the
"else" block is actually part of the first "if" statement.
Am I misinformed, or is it a bug?


Thank you for your time!

☆*PhistucK*

-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users

Reply via email to