Skip to content

Object initializer for complex object( object inside object) #2597

@ghost

Description

Hi every one. I found next problem:

let notWork = {
    prop1: {
        [prop2]: 'value'
    }
};

is equal to:

{ prop1: {} }

on the other hand this construction:

let workFine = {
    ['prop1']: {
        ['prop2']: 'value'
    }
};

work fine:

{ prop1: { prop2: 'value' } };

I didn't find any descriptions for complex object in specification.
Can I initialize objects like in first example or this is a bug ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateIssues and PRs that are duplicates of other issues or PRs.v8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions