guest271314 (2019-03-22T19:02:17.000Z)
>
> shouldn't it have created a variable '0' and '1' ?


No. See Assigning to new variable names
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Assigning_to_new_variable_names


On Fri, Mar 22, 2019 at 6:38 PM J Decker <d3ck0r at gmail.com> wrote:

>
>
> On Fri, Mar 22, 2019 at 10:32 AM guest271314 <guest271314 at gmail.com>
> wrote:
>
>>
>> If gather the expected result correctly object destructuring can be used
>>
>>     const {0: a, 1: b} = {0: a, 1: b, length: 2}
>>
>
> var a = "testa", b="testb"; const {0: c, 1: d} = {0: a, 1: b, length: 2}
> results in a const 'c' and const 'd' created with the vlaues of a and b.
>
> shouldn't it have created a variable '0' and '1' ?
>
>>
>> On Wed, Mar 20, 2019 at 12:59 AM Sultan <thysultan at gmail.com> wrote:
>>
>>> Afford array destructuring to Array-like objects.
>>>
>>> const [a, b] = {0: a, 1: b, length: 2}
>>>
>>>
>>> _______________________________________________
>>> es-discuss mailing list
>>> es-discuss at mozilla.org
>>> https://mail.mozilla.org/listinfo/es-discuss
>>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190322/9ac92ae5/attachment.html>
guest271314 at gmail.com (2019-03-22T19:05:18.230Z)
> shouldn't it have created a variable '0' and '1' ?


No. See Assigning to new variable names
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Assigning_to_new_variable_names

> A property can be unpacked from an object and assigned to a variable with a different name than the object property.