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


1 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
2 Until page fully formed, any of its properties can be undefined
3 Modern JavaScript allows one to test if variables are defined and so avoid these errors
4 in a.b.c.d.e type reference, one must first test if a exists, then b, then ....
5 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

in Table To:


© 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