Can properties of an object somehow be assigned to multiple variables in JavaScript with a single call (for convenience)?
function getValues() {
return {
first: 1,
second: 2
};
}
function convenientAssignment() {
let first = 0;
let second = 0;
{first, second} = getValues(); // <-- How can this be achieved?
console.log("Values:", first, second);
}
Without using separate assignments like the following:
let values = getValues();
first = values.first;
second = values.second;
This question has nothing to do with concurrency.