say I have an object:
{ foo: 1, bar: 'a', baz: [1,2,3] }
how to assign the value of baz to get the head and the tail of the array?
I mean so that the effect is the same as that of the code below, except for I do not want to use the extra variable baz:
{ baz } = obj;
[head, ...tail] = baz;
I know I can say [head, ...tail] = obj.baz but my question is about the syntax.