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


Groups > comp.lang.javascript > #33972

Re: undefined string in an object?

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: undefined string in an object?
Date 2017-09-10 16:20 +0200
Organization PointedEars Software (PES)
Message-ID <33454482.oW9n1slzhM@PointedEars.de> (permalink)
References <bb27e72b-f746-44f9-a1d5-d6c5673b9ef7@googlegroups.com> <op0sil$dcd$1@gioia.aioe.org>

Show all headers | View raw


Joao Rodrigues wrote:

> JRough wrote:
>> 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,
> 
> This object literal is being defined accordingly.

The (referred) _object_ is being defined as intended.

An object *literal* (standard term: “object _initializer_”; it is actually 
_not_ listed under “11.8 Literals”[1]) is an *expression* that begins with 
“{”, ends with “}”, and can be produced by the /ObjectLiteral/ production
of the ECMAScript grammar:

<http://www.ecma-international.org/ecma-262/8.0/#prod-ObjectLiteral>

    [Yes, *8.0*: “ECMAScript® 2017 Language Specification
     (ECMA-262, 8th edition, June 2017”.
                             ^^^^^^^^^
     Harder to keep track of this nowadays.  Given the recent releases,
     I just tried the greater revision number, and there it was.]

For example, “{}” is an object initializer; so are “{foo: "bar"}” and 
“{"baz": 42}”.

An object is a conceptual entity only: it exists only abstractly, and in 
memory only inasfar as that memory is reserved to store therein the bindings 
that refer to the object, and the names and the values of its properties.

By contrast, an object *initializer* is an element of the syntax of these 
programming languages.

<http://www.ecma-international.org/ecma-262/8.0/#sec-terms-and-definitions-object>

__________
[1] <http://www.ecma-international.org/ecma-262/8.0/#sec-ecmascript-language-lexical-grammar-literals>
-- 
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.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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