What Are Statements?
All JavaScript that is written, whether it be a single line or a monster mini-program, consists of a sequence of statements. You've already seen such statements. The following alert box being generated is a result of a statement:
<script language="JavaScript"> <!-- Cloaking device on! alert("This is a statement!"); // Cloaking device off --> </script>
So is this:
<script language="JavaScript"> <!-- Cloaking device on! var ournames = "Adrian and Kathie"; // Cloaking device off --> </script>
And here are several more statements:
<script language="JavaScript"> <!-- Cloaking device on! var ournames = "Adrian and Kathie", ans; alert("Welcome from " + ournames); ans = prompt("Do you like JavaScript?", "Yes or No"); alert(ans); ...
Get JavaScript™ 1.5 by Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.