Suggestion: Destructuring object initializer.

Yeong-u Kim wlzla000 at
Thu Feb 8 09:45:02 UTC 2018

# Suggestion: Destructuring object initializer.
 Destructuring assignment: it extracts values by destructuring an object, and assign _them_ to ‘variables.’ I suggest Destructuring object initialization syntax; it is similar to Destructuring assignment, except that it initializes an object with _the extracted values_.
```javascriptconst name_info = {"first name": "Yeong-u", "last name": "Kim", nickname: "K."};const e = "computed property name";
const object = {	name: {		*{"first name": forename, "last name": surname}: name_info	},	*[a, b, c]: [1, 2, 3],	*[d]: [4],	[e]: "This is not part of the syntax"	*[{"some property name": "new one"}]: [{"some property name": 5}],	*{gettable: something}: {get gettable() {return Symbol("Using [[Get]]");}}};/*	{		name: {			forename: "Yeong-u",			surname: "Kim"		},		a: 1,		b: 2,		c: 3,		d: 4,		"computed property name": "This is not part of the syntax",		"new one": 5,		something: Symbol(Using [[Get]])	}*/```
 I would appreciate hearing your opinion on this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list