please dont rip this site
Microsoft® JScript
Writing JScript Code
| Tutorial |


A Microsoft JScript code statement consists of one or more items and symbols on a line. A new line begins a new statement, but it is a good idea to terminate your statements explicitly. The semicolon (;) is the termination character.


aBird = "Robin";
var today = new Date();
A group of JScript statements that is surrounded by braces is called a block. Blocks of statements are used, for example, in functions and conditionals. In the following example, the first statement begins the definition of a function, which consists of the block of five statements that follows. The last three statements, which are not surrounded by braces, do not constitute a block and are not part of the function definition.


function convert(inches)  {
    feet = inches / 12;  //  These five statements are in a block.
    miles = feet / 5280;
    nauticalMiles = feet / 6080;
    cm = inches * 2.54;
    meters = inches / 39.37;
}
km = meters / 1000;  //  These three statements are not in a block.
kradius = km;
mradius = miles;

Comments

A single-line JScript comment begins with a pair of forward slashes (//). A multiline comment begins with a forward slash and asterisk in combination (/*), and ends with the reverse (*/).


aGoodIdea = "Comment your code thoroughly.";  //  This is a single-line comment.

/*
This is a multiline comment that explains the preceding code statement.

The statement assigns a value to the aGoodIdea variable. The value, which is contained
between the quote marks, is called a literal. A literal explicitly and directly contains
information, rather than referring to the information indirectly. (The quote marks are not
part of the literal.)
*/

//  This is another multiline comment, written as a series of single-line comments.
//  After the statement is executed, you can refer to the content of the aGoodIdea
//  variable by using its name, as in the next statement, in which a string literal is
//  appended to the aGoodIdea variable by concatenation to create a new variable.

var extendedIdea = aGoodIdea + " You never know when you'll have to figure out what it does.";
JScript Assignments
If you are just beginning to become familiar with programming, please be aware that the equal sign (=) is used in JScript to indicate the action of assigning a value. That is, if a JScript code statement says


anInteger = 3;
it means "Assign the value 3 to the variable anInteger," or "anInteger gets 3." When you need to compare two values to find out whether they are equal, use a pair of equal signs (==). This issue is discussed in detail in conditionals.

Expressions
The term expression, in JScript, is something that a human being can read as a Boolean or numeric expression. Expressions contain symbol characters like "+" rather than words like "added to". Any legal combination of values, variables, operators, and expressions constitutes an expression.


var anExpression = "3 * (4 / 5)";
var aSecondExpression = "Math.PI * radius * 2";
var aThirdExpression = aSecondExpression + "%" + anExpression;
var aFourthExpression = "(" + aSecondExpression + ") % (" + anExpression + ")";

© 1996 by Microsoft Corporation.


file: /Techref/language/asp/js/313.htm, 4KB, , updated: 1996/11/22 11:12, local time: 2024/5/23 05:01,
TOP NEW HELP FIND: 
34.239.158.223:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://piclist.com/techref/language/asp/js/313.htm"> Microsoft&#174; JScript Language Tutorial </A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host massmind.org, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
 

Welcome to piclist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .