Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #26992
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: How do I access nested key/value pairs? |
| Date | 2015-03-05 16:25 +0100 |
| Organization | PointedEars Software (PES) |
| Message-ID | <2031858.aWiVlKuHNg@PointedEars.de> (permalink) |
| References | <3e102a71-73a4-41d5-811d-de9d0952f0cd@googlegroups.com> <md7hnr$3qu$1@dont-email.me> |
Denis McMahon wrote:
> On Wed, 04 Mar 2015 07:51:44 -0800, Masoom Tulsiani wrote:
>> var hash =
>
> hash seems to be an object containing three anonymous objects with no
> means of distinguishing them.
>
> Trying to load this in javascript causes an error because each element of
> an object (including a nested object) requires an identifier.
Utter nonsense.
- There is no “javascript”, see my sig.
- Objects do not have names (so it makes no sense to speak of “anonymous
objects”); they have identity (one object is different from another).
- Objects do not have elements; they have properties. *Arrays* have
elements; they are objects which also have indexes (special property
names).
- Property names do not need to be identifiers (for example, indexes are
not identifiers as they are representation of integers). In
implementations of ECMAScript Edition 5 and later they can even be
reserved words.
var x = {"1701foo": "bar"};
var u = x;
/* "bar" */
u["1701foo"]
x["1701foo"] = "baz";
/* "baz" */
u["1701foo"]
/* true */
u == x
/* true */
u === x
/* ES 5+ only */
x.float = Math.PI;
/* 3.141592653589793… */
u.float
--
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How do I access nested key/value pairs? Masoom Tulsiani <masoom.tulsiani@gmail.com> - 2015-03-04 07:51 -0800
Re: How do I access nested key/value pairs? John Harris <niam@jghnorth.org.uk.invalid> - 2015-03-04 16:14 +0000
Re: How do I access nested key/value pairs? Denis McMahon <denismfmcmahon@gmail.com> - 2015-03-04 18:08 +0000
Re: How do I access nested key/value pairs? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-03-05 16:25 +0100
Re: How do I access nested key/value pairs? John Harris <niam@jghnorth.org.uk.invalid> - 2015-03-06 10:26 +0000
Re: How do I access nested key/value pairs? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-03-06 12:20 +0100
Re: How do I access nested key/value pairs? John Harris <niam@jghnorth.org.uk.invalid> - 2015-03-06 20:18 +0000
Re: How do I access nested key/value pairs? Scott Sauyet <scott.sauyet@gmail.com> - 2015-03-04 12:15 -0800
Re: How do I access nested key/value pairs? Scott Sauyet <scott.sauyet@gmail.com> - 2015-03-04 12:17 -0800
csiph-web