HELP! * YELLOW=global GREY=local Global HTML version of Foils prepared 21 February 97

Foil 3 The JavaScript Language -- Values, Names Etc.

From Feb 17/19 Delivered Lecture for Course CPS616 -- aJavaScript Language Objects and Frames CPS616 spring 1997 -- Feb 17 and 19 1997. by Geoffrey Fox * Important Information in IMAGE
Secs 38.8 Addon
JavaScript only has one simple type -- namely:
var anumber = 137; // or the SAME type var
var astring = "1"; // to define a string
The loose typing in JavaScript, allows interpreter to creatively interpret an expression and default (this is change from early documentation which claimed type taken from leftmost variable) is that strings have precedence over numbers so that for instance:
x = astring + anumber; // results in x = "1137"
use parseInt and parseFloat to extract numerical values from strings (see later)
Note special value null (no quotes) can be used as a null value
Strings can be delimited by '..text..' or "..text.." which are identical in meaning (unlike PERL) and one can use \n for newline and \t for TAB
Boolean literals are either true or false
Comments are /* any stuff including newlines */ or
Javascript statements; // This is a comment until new line


Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Fri Feb 21 1997