Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #34012
| X-Received | by 10.129.124.193 with SMTP id x184mr1315751ywc.191.1506182559802; Sat, 23 Sep 2017 09:02:39 -0700 (PDT) |
|---|---|
| X-Received | by 10.157.26.108 with SMTP id u41mr35435otu.29.1506182559745; Sat, 23 Sep 2017 09:02:39 -0700 (PDT) |
| Path | csiph.com!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!b1no2188854qtc.1!news-out.google.com!p6ni2058itp.0!nntp.google.com!o200no1218217itg.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.javascript |
| Date | Sat, 23 Sep 2017 09:02:39 -0700 (PDT) |
| In-Reply-To | <urbcsc19viuqf368qkjjo42iugldst9j7h@4ax.com> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=84.217.164.78; posting-account=kxPkPAoAAACjJi8w0gL9bnyznPzdw9HW |
| NNTP-Posting-Host | 84.217.164.78 |
| References | <bb27e72b-f746-44f9-a1d5-d6c5673b9ef7@googlegroups.com> <3038716d-f026-476d-b8e6-2634878fab72@googlegroups.com> <urbcsc19viuqf368qkjjo42iugldst9j7h@4ax.com> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <c13d172e-04be-4ef7-a993-ecc7d290f8ad@googlegroups.com> (permalink) |
| Subject | Re: undefined string in an object? |
| From | jonas.thornvall@gmail.com |
| Injection-Date | Sat, 23 Sep 2017 16:02:39 +0000 |
| Content-Type | text/plain; charset="UTF-8" |
| Content-Transfer-Encoding | quoted-printable |
| Lines | 64 |
| Xref | csiph.com comp.lang.javascript:34012 |
Show key headers only | View raw
Den lördag 23 september 2017 kl. 11:55:50 UTC+2 skrev John G Harris:
> On Fri, 22 Sep 2017 06:11:54 -0700 (PDT), jonas.thornvall@gmail.com
> wrote:
>
> >Den torsdag 7 september 2017 kl. 01:33:10 UTC+2 skrev JRough:
> >> me (JRough change)
> >>
> >> 4:31 PM (less than a minute ago)
> >>
> >>
> >> var a={};
> >> a["b"]=123,
> >> a["c"]=456;
> >> console.log(a["b"]);
> >> undefined
> >>
> >> var a={};
> >> a.b=123,
> >> a.c=456;
> >> console.log(a.b);
> >> undefined
> >>
> >>
> >> Why is this object literal not defined? If it is because it was stringified how to make it an object again so you get the value? tnx,
> >
> >Can you really have a string as an index?
>
> Yes.
>
> a["b"]=123;
> is specified by the ECMAScript Standard to mean exactly the same as
> a.b=123;
>
>
> >isn't a[] supposed to be an array, i see you guys call it object here?
>
> a is an ordinary object, but you can use array notation to select a
> property.
>
> John
Thanks John i think i learned something, i see what a property is.
You say that if you have a property of an object, a["b"]=123; "b" is the property and 123 is the property value?
I can reach the variable stored by c=a["b"] and then
console.log(c);
Will write out 123?
I guess a is the object so how many properties can an object have?
Can an objects property also refer to a new object itself?
So you can make a relational chain with objects?
That somehow would need objects possible to be created on the fly without have them defined, so it probably not possible?
var a={};
a[b={}]=1,
The neat thing with arrays and indexes is that they are easily accesible, so it possible to make relational structures quite easy, i was just thinking if something similar was possible with objects.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
undefined string in an object? JRough <janis.rough@gmail.com> - 2017-09-06 16:33 -0700
Re: undefined string in an object? Joao Rodrigues <groups_jr-1@yahoo.com> - 2017-09-09 11:07 -0300
Re: undefined string in an object? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-09-10 16:20 +0200
Re: undefined string in an object? John G Harris <niam@jghnorth.org.uk.invalid> - 2017-09-18 15:37 +0100
Re: undefined string in an object? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-09-18 17:17 +0200
Re: undefined string in an object? John G Harris <niam@jghnorth.org.uk.invalid> - 2017-09-19 11:05 +0100
Re: undefined string in an object? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-09-19 12:58 +0200
Re: undefined string in an object? Flng Fck <nothanks@invalid.invalid> - 2017-09-20 09:37 +0200
Re: undefined string in an object? John G Harris <niam@jghnorth.org.uk.invalid> - 2017-09-20 10:49 +0100
Re: undefined string in an object? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-09-20 20:29 +0100
Re: undefined string in an object? John G Harris <niam@jghnorth.org.uk.invalid> - 2017-09-21 16:12 +0100
Re: undefined string in an object? jonas.thornvall@gmail.com - 2017-09-22 06:11 -0700
Re: undefined string in an object? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-09-22 19:20 +0200
Re: undefined string in an object? John G Harris <niam@jghnorth.org.uk.invalid> - 2017-09-23 10:55 +0100
Re: undefined string in an object? jonas.thornvall@gmail.com - 2017-09-23 09:02 -0700
csiph-web