[Javascript] Object References
Hakan Magnusson
hakan at backbase.com
Mon Jun 7 05:05:54 CDT 2004
As a useless sidenote most people tend to think differently of; the WITH
statement should not be overused, and definately not used as a speed
optimizing construct, since it's (in my experience) considerably slower
than multiple rows of object.component.property = value;.
2 cents.
Regards,
H
Flavio Gomes wrote:
> Yes, there's a with statement:
>
> <form name=myForm>
> First Name:<br><input name=firstname size=30><br>
> Surname:<br><input name=surname size=30>
> </form:
>
> with(document.myForm)
> {
> alert(firstname);
> alert(surname);
> }
>
> ---
> Flavio Gomes
> flavio at economisa.com.br
>
> Mike Dougherty wrote:
>
>> Given this:
>>
>> var loTP = (some object)
>> for (itm in loTP.Area0112) {
>> loTP.Area0112[itm].prop0 = (something)
>> loTP.Area0112[itm].prop1 = (something else)
>> loTP.Area0112[itm].prop2 = (something else)
>> }
>>
>> Would it be "better" to reduce the object references to this:
>>
>> var loTP = (some object)
>> for (itm in loTP.Area0112) {
>> var loCurObj = loTP.Area0112[itm]
>>
>> loCurObj.prop0 = (something)
>> loCurObj.prop1 = (something else)
>> loCurObj.prop2 = (something else)
>> }
>>
>> Is there a "With" construct? what is the syntax/usage? (does it
>> matter?)
>> (My question is whether or not there is a reason to reduce the length
>> of the reference, not to ask about syntax I probably could look up)
>>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
More information about the Javascript
mailing list