Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Re: While statement array losing data
- From: twlewis at softhome.net (Tim Lewis)
- Subject: [Javascript] Re: While statement array losing data
- Date: Thu May 17 09:12:05 2007
So JScript passes the actual data instead of a pointer to it? > On 17 May 2007, at 14:15:22, Tim Lewis wrote: > >> I finally found my problem. Apparently if an array item is >> populated with >> a numeric value, the value gets lost after leaving the While loop. A >> string is preserved. I changed the code to change the integer to a >> string: >> sLineIn[iResultCount] = sTransCount+""; >> It works now. >> > > Your reply overlapped with my reply to your original question :-) > > However, the stuff in my previous reply is still relevant. What > happens when you do the above is that JScript will try to add the > empty string to whatever is referenced by sTransCount, find that the > referenced thing is a COM object, and convert it to a JScript string > by taking its default (in this case "Value") property (as I described > previously). So it's the same thing as using the default property of > the Field object, as VBScript does by default. > > If you're working with COM objects such as ADO RecordSets and > associated objects, it's worth understanding the difference between > them and JScript objects - the difference doesn't arise in VBScript, > as that is also "built out of COM", but JScript (which is at heart a > COM component) adds some of its own behaviours, and removes or masks > others. > > There's an article mentioning one of the differences at Eric > Lippert's blog - he's the guy who wrote VBscript and was involved in > writing JScript: > <http://blogs.msdn.com/ericlippert/archive/2003/09/15/53005.aspx> > with links to more information. > > Regards, > > Nick. > -- > Nick Fitzsimons > http://www.nickfitz.co.uk/ > > > > _______________________________________________ > Javascript mailing list > Javascript@xxxxxxxxxx > https://lists.LaTech.edu/mailman/listinfo/javascript >
- References:
- [Javascript] Replace Characters
- From: Tim Lewis
- [Javascript] While statement array losing data
- From: Tim Lewis
- [Javascript] Re: While statement array losing data
- From: Tim Lewis
- [Javascript] Re: While statement array losing data
- From: Nick Fitzsimons
- [Javascript] Replace Characters
- Prev by Date: [Javascript] Re: While statement array losing data
- Next by Date: [Javascript] While statement array losing data
- Previous by thread: [Javascript] Re: While statement array losing data
- Next by thread: [Javascript] While statement array losing data
- Index(es):