Basic HTML version of Foils prepared 26 March 99

Foil 8 Is a variable defined?

From Architecture and Implementation of JavaScript Shared Browser Tango Group Seminar -- 26 March 99. by Geoffrey C. Fox


One must NEVER access an undefined variable
  • if in JavaScript that is linked to LiveConnect, one gets a Java error which requires restarting Netscape .....
  • If in less sensitive JavaScript, execution of script stops and action unpredictable
Until page fully formed, any of its properties can be undefined
Modern JavaScript allows one to test if variables are defined and so avoid these errors
in a.b.c.d.e type reference, one must first test if a exists, then b, then ....
WWutility.js includes
  • WW_isdefined(property) returns true if argument is defined as a property or method
  • WW_isitawindow(possibleframe) returns true if argument is a window or frame



© 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 Mar 26 1999