It's not really an associative array. It is the property of an
object, there are two notations for getting at an objects properties:
foo.bar
and
foo['bar']
though you could even:
eval('foo.' + fooProp);
foo.bar is the preferred method, but if the property name has a space
in it or needs to
alert( foo[fooProp] );
On Feb 13, 2:05 pm, Nic adaptive...@gmail.com wrote:
For instance,
var foo = {
bar: barVal,
baz: bazVal
}
var fooProp = bar;
How can I access barVal through fooProp?
I know this isn't exactly jQuery group discussion but I figured since
it was part of a jQuery
foo[fooProp] // returns barVal
Is that what you mean?
-- Josh
-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Nic
Sent: Friday, February 13, 2009 4:06 PM
To: jQuery (English)
Subject: [jQuery] Accessing a JSON property from an
Oh wow, I didn't realize JSON would act like an associative array in that
way...
Thanks guys!
On Fri, Feb 13, 2009 at 7:10 PM, Josh Nathanson joshnathan...@gmail.comwrote:
foo[fooProp] // returns barVal
Is that what you mean?
-- Josh
-Original Message-
From:
4 matches
Mail list logo