In LZX, it’s often sensible to test JavaScript properties before using them, to be sure that they are defined, e.g.
// Bad example
if (someObject.someValue) {
setAttribute(”x”, someObject.someValue);
} else {
var defaultValue = 123;
setAttribute(”x”, defaultValue);
}
In the above example, if someObject.someValue were undefined, then the conditional test would fail and the default value would be used. However there are a [...]
Entries from June 2008
Testing Properties
June 24th, 2008 · No Comments
Tags: LZX Tips · OpenLaszlo