Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #26992

Re: How do I access nested key/value pairs?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: How do I access nested key/value pairs?
Supersedes <1933072.Sqv6qEQ7LK@PointedEars.de>
Date Thu, 05 Mar 2015 16:25:27 +0100
Organization PointedEars Software (PES)
Lines 52
Message-ID <2031858.aWiVlKuHNg@PointedEars.de> (permalink)
References <3e102a71-73a4-41d5-811d-de9d0952f0cd@googlegroups.com> <md7hnr$3qu$1@dont-email.me>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Trace solani.org 1425569206 2609 eJwFwQcBACAMAzBL7DM57NS/BBITJ+9QN1eDwbkzLvgFyWxiBL3Y5dTSu++wHNYiWG9N8wcr+BHy (5 Mar 2015 15:26:46 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Thu, 5 Mar 2015 15:26:46 +0000 (UTC)
User-Agent KNode/4.14.2
Cancel-Key sha1:5ANOvtVi5I1tmGxu3TVfJfq34As=
X-User-ID eJwNwokRwDAIA7CVKOHrOAaT/UdoT/ITT0xaeJjf3wAduIz0pcp2IR+Dq3BmF2dFwDRlkTtgA1or9Wbdzg+U2Rdf
Cancel-Lock sha1:V3vbXASHWUMyHmPXdJaIixQCvOw=
X-NNTP-Posting-Host eJwFwYEBACAEBMCViEfjqM/+I3QHC42bHgjHYBw1nTqzeaT6ksLOBvst43YJXbR6ftQVxg8zkhGF
Xref csiph.com comp.lang.javascript:26992

Show key headers only | View raw


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


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