Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #33962 > unrolled thread
| Started by | JRough <janis.rough@gmail.com> |
|---|---|
| First post | 2017-09-06 16:31 -0700 |
| Last post | 2017-09-08 11:14 +0200 |
| Articles | 7 — 4 participants |
Back to article view | Back to comp.lang.javascript
object is undefined JRough <janis.rough@gmail.com> - 2017-09-06 16:31 -0700
Re: object is undefined Andrew Poulos <ap_prog@hotmail.com> - 2017-09-07 11:23 +1000
Re: object is undefined Andrew Poulos <ap_prog@hotmail.com> - 2017-09-07 11:27 +1000
Re: object is undefined JRough <janis.rough@gmail.com> - 2017-09-06 18:33 -0700
Re: object is undefined Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-09-08 09:21 +0200
Re: object is undefined Jake Jarvis <pig_in_shoes@yahoo.com> - 2017-09-08 10:59 +0200
Re: object is undefined Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-09-08 11:14 +0200
| From | JRough <janis.rough@gmail.com> |
|---|---|
| Date | 2017-09-06 16:31 -0700 |
| Subject | object is undefined |
| Message-ID | <8418d597-62e8-42da-a639-1d886a3ea913@googlegroups.com> |
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? tnx,
[toc] | [next] | [standalone]
| From | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| Date | 2017-09-07 11:23 +1000 |
| Message-ID | <tJmdnTNai-A8Ai3EnZ2dnUU7-UOdnZ2d@westnet.com.au> |
| In reply to | #33962 |
On 7/09/2017 9:31 AM, JRough wrote:
> 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? tnx,
Possibly because of the comma at the end of the line (instead of semi
colon).
Andrew Poulos
[toc] | [prev] | [next] | [standalone]
| From | Andrew Poulos <ap_prog@hotmail.com> |
|---|---|
| Date | 2017-09-07 11:27 +1000 |
| Message-ID | <EcadnbLWJ4EfPS3EnZ2dnUU7-UHNnZ2d@westnet.com.au> |
| In reply to | #33964 |
On 7/09/2017 11:23 AM, Andrew Poulos wrote:
> On 7/09/2017 9:31 AM, JRough wrote:
>> 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? tnx,
>
> Possibly because of the comma at the end of the line (instead of semi
> colon).
I posted without testing. In Chrome your code returns the correct value
so it's probably something else you're doing.
Andrew Poulos
[toc] | [prev] | [next] | [standalone]
| From | JRough <janis.rough@gmail.com> |
|---|---|
| Date | 2017-09-06 18:33 -0700 |
| Message-ID | <490eefde-9cb0-4cc9-8e88-5878844180aa@googlegroups.com> |
| In reply to | #33965 |
On Wednesday, September 6, 2017 at 6:27:42 PM UTC-7, Andrew Poulos wrote:
> On 7/09/2017 11:23 AM, Andrew Poulos wrote:
> > On 7/09/2017 9:31 AM, JRough wrote:
> >> 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? tnx,
> >
> > Possibly because of the comma at the end of the line (instead of semi
> > colon).
>
> I posted without testing. In Chrome your code returns the correct value
> so it's probably something else you're doing.
>
> Andrew Poulos
Thanks a lot. I played around iwth my console in chrome some setting was doing that. don't even know what but now it says 123. thanks,
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2017-09-08 09:21 +0200 |
| Message-ID | <50170722.5lcoankNRJ@PointedEars.de> |
| In reply to | #33962 |
Stefan Ram wrote: > JRough <janis.rough@gmail.com> writes: >>console.log(a["b"]); >>undefined > > The value of the call »console.log(...)« usually /is/ > undefined. The _return value of the method_ is _defined_ to be: <https://console.spec.whatwg.org/#log> > The actual output might not have appeared in the console this was copied > from. Doubtful. > So, possibly, one just sees the value of the call. The _return value of the method_, _definitely_. -- PointedEars FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix> <https://github.com/PointedEars> | <http://PointedEars.de/wsvn/> Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | Jake Jarvis <pig_in_shoes@yahoo.com> |
|---|---|
| Date | 2017-09-08 10:59 +0200 |
| Message-ID | <ootm57$rcj$1@dont-email.me> |
| In reply to | #33968 |
Am 08.09.2017 um 09:21 schrieb Thomas 'PointedEars' Lahn:
> Stefan Ram wrote:
>> The actual output might not have appeared in the console this was copied
>> from.
>
> Doubtful.
Why? Is that a disagree-by-default?
Changing levels does that and it makes sense with
| I played around iwth my console in chrome some setting was doing
| that. don't even know what but now it says 123. thanks,
Default levels:
console.log("asdf")
VM168:1 asdf
undefined
Custom levels (like only Warnings and Errors):
console.log("asdf")
undefined
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2017-09-08 11:14 +0200 |
| Message-ID | <4847671.42YvSobyyN@PointedEars.de> |
| In reply to | #33969 |
Jake Jarvis wrote:
> Am 08.09.2017 um 09:21 schrieb Thomas 'PointedEars' Lahn:
>> Stefan Ram wrote:
>>> The actual output might not have appeared in the console this was
>>> copied from.
>>
>> Doubtful.
>
> Why?
I considered the possibilities that the output may have appeared in another
console, or not at all, and found them improbable.
> Is that a disagree-by-default?
No.
> Changing levels does that and it makes sense with
ACK.
> | I played around iwth my console in chrome some setting was doing
> | that. don't even know what but now it says 123. thanks,
This had not been quoted.
> Default levels:
> console.log("asdf")
> VM168:1 asdf
> undefined
>
> Custom levels (like only Warnings and Errors):
> console.log("asdf")
> undefined
ACK. I had not thought of that.
--
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web