Creating ASP Pages with JScript
Web
developers
who are familiar with writing client-side
JavaScript code
already have a good understanding of JScript’s syntax and
structure. JScript’s syntax and control structures are also
very similar to C’s. For example, JScript’s control
structures — if ... else,
switch, while,
do ... while, and
for statements — are syntactically identical
to C’s.
Statement Termination
JScript handles its statement termination a bit differently than C. In C, a semicolon is needed to end a statement; in JScript, either a semicolon or a newline character will suffice. Therefore, you can have a JScript statement end without a semicolon as long as the next statement begins on a new line. You can have multiple statements on one line, but then a semicolon must delimit each of these statements. For example, the following code fragment illustrates the legal and illegal use of semicolons and newline characters:
<% @LANGUAGE = "JScript" %>
<%
Response.Write("Each new-line character represents")
Response.Write("a new statement in JScript. So does a semicolon.<P>")
// This is legal code:
Response.Write("Hello, "); Response.Write("World!");
// This is not:
Response.Write("Hello, ") Response.Write("World!");
%>I highly recommend always ending each statement with a semicolon, regardless of whether the next statement starts on a new line. JScript code examples in this book will adhere to this strict use of semicolons.
JScript’s Variables and Datatypes
JScript does not require ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access