I have two variables:
let a, b;
No I'd like to do a destructuring object assignment with these existing variables. When creating new variables isn't a problem, you might go ahead with:
let {x, y} = myFunc();
However, as I want to overwrite the existing variable, I'm asking myself about the preferred way. Using
{a, b} = myFunc();
will cause:
expected expression, got '='
Of course I could do:
let ret = myFunc();
a = ret.a;
b = ret.b;
But this seems to be an overhead.
How to do a destructuring object assignment to existing variables?