Closed
Bug 1495191
Opened 7 years ago
Closed 7 years ago
a
Categories
(Developer Documentation Graveyard :: General, enhancement)
Tracking
(Not tracked)
RESOLVED
INVALID
People
(Reporter: tdtrendafilov, Unassigned)
References
()
Details
:: Developer Documentation Request
Request Type: Correction
Gecko Version: unspecified
Technical Contact:
:: Details
// In other words,
console.log((o.a === {a}.a)); // true
I think that it should be without the dot between {a}a
console.log((o.a === {a}a)); // true
Comment 1•7 years ago
|
||
that's syntax error.
property access needs either dot (.) or bracket ([])
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
Reporter | ||
Comment 2•7 years ago
|
||
(In reply to Tooru Fujisawa [:arai] from comment #1)
> that's syntax error.
> property access needs either dot (.) or bracket ([])
-------------------------------------------------------------------------------------------------------------------------------
Yes you are that property access for objects requires either dot (.) or bracket ([]), but in the example we are talking about a string. Here is the result both in Mozilla Firefox and Google Chrome.
var a = 'foo';
undefined
{a}a;
"foo"
{a}.a;
SyntaxError: expected expression, got '.' [Learn More]
Please take a look in the example and correct the content in the documentation. Here is the full example(text) from the documentation:
(
With ECMAScript 2015, there is a shorter notation available to achieve the same:
var a = 'foo',
b = 42,
c = {};
// Shorthand property names (ES2015)
var o = {a, b, c};
// In other words,
console.log((o.a === {a}.a)); // true
);
You need to log in
before you can comment on or make changes to this bug.
Description
•