HELP! * GREY=local LOCAL HTML version of Foils prepared 26 February 1996

Foil 10 The JavaScript Language -- Expressions - I

From CPS616 Lectures on JavaScript CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. by Geoffrey C. Fox * See also color IMAGE

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 Tue Feb 18 1997