Deep creation of object...

var = true
Binding variable like this could actually set it up as nested object, instead of giving error that it cannot access it from certain point.

1 Like

What's the point? Just write what you mean to do:

var x = {chrome: {tab: true}};

I don't see the problem that this is trying to solve.


Because then in nested structures you have to overwrite whole objects, or use Object.Assign... Both of which are unnecessary crap standing in million lines of finished code every day.

A quick solution is using camel-case. i.e.
var xChromeTab = true;

To achieve this idea, I think that we need a feature that group/nest some properties, instead of using an object.

Take in DOM/CSSOM as an example:

A feature that allows writing without nesting objects
and it represents as a flatten internal property, say "styleBorderBottomColor" of element object.

I agree that writing or trying to read a nested Object.assign is no fun.

// var = true
  x, { chrome: Object.assign( ?? {},
    { tab: true }

One alternative is to use lodash - set

import set from 'lodash/set';

set(x, '', true);
// or
set(x, ['chrome', 'tab'], true);