I'm abit confused here, I create an associative array using
var foo = new Array
foo['dosge'] = 'car';

without issue.  I can see that Array is an Object perhaps, but teh
above does work.  Well, I'm not certain it will work in all JS in all
browsers, I'm kind of lucky, I work on a sterile intranet.

Doug

----- Original Message -----
From: Jim Davis <[EMAIL PROTECTED]>
Date: Sat, 28 Aug 2004 14:11:16 -0400
Subject: RE: CF and JS question
To: CF-Talk <[EMAIL PROTECTED]>

In _javascript_ associative arrays are always Objects - doing "new Object"
always creates an associative array (or, more specifically something that
can be used as an associative array) and doing "new Array" always results in
an indexed array.  There's no way to create an associative array using the
Array object.

CF is similar for CFCs (in that all CFCs are actually structures).  But in
CF all CFCs are structs but all structs are not CFCs where in _javascript_ all
associative arrays are Objects and all Objects are associative arrays.

Jim Davis

From: S. Isaac Dealey [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 28, 2004 1:04 PM
To: CF-Talk
Subject: Re: CF and JS question

> Actually, JS supports associative arrays also.  So,
> foo['apple'] =
> fruit is perfectly fine.  Hence the need for
> JSStringFormat() when
> creating these via CF, in case there's a ' or something.

> Doug

Ahh... Well I've always just used Object() for that -- which is also
what cfwddx uses... I suspect that's for backward compatibility with
some earlier versions of JS or at least the JS engines in some earlier
browsers.________________________________
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to