HELP! * GREY=local LOCAL HTML version of Foils prepared 15 January 1997

Foil 21 The JavaScript Language -- Expressions - I

From JavaScript Tutorial for CPS616 Technologies of the Information Age 1997 Basic Information Track of CPS -- Spring Semester 97. by Geoffrey C. Fox * Important Information in IMAGE
Addon
JavaScript expressions and basic operators are similar to C PERL and Java
Assignment Operators are = += -= *= /= %= <<= >>= >>>= &= ^= |=
  • with x += y; meaning x= x + y;
  • and x %= y; meaning x = x%y; // x mod(y)
Conditional Expressions
  • status = (age >= 18) ? "adult" : "minor"; // sets status to be "adult" if age is larger than or equal to 18. Otherwise it is set to "minor"
Arithmetic operators are as usual with in addition ++ and --
  • y = ++x; // increments x by 1 and sets y to be final value of x



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 Sat May 24 1997