Thanks Tucker!
I have a related question. When I find object properties that are not
defined, I am giving them an initial value of null. This eliminates the
problem with undefined and allows me to do this,
if (this.somevariable)
...
in the code. This makes cleaner code but it does potentially define a lot
of properties that are not often used.
Any advice?
Phil
> `in` is not yet supported in the SWF runtime.
>
> `hasOwnProperty` is supported in both runtimes. When we use `new
> Object` or literal objects to represent hash tables, best practice is
> to use `hasOwnProperty` to detect the presence of a key in the
> table. (Consider a table that might have the keys `toString`,
> `constructor`, etc. which are inherited by all objects: only
> `hasOwnProperty` can tell if those keys are in the table or not.)
>
> So my recommendation to Phil is to use `hasOwnProperty` anywhere it
> is clear that we are using an object as a hash table and only resort
> to `[]` or `typeof` if it is not clear.
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev