ES6 destructuring within a return statement
No, it’s not possible. (Disclaimer: your syntax works and does both destructuring and returning, but it is equivalent to ({ id, name, price } = newItem); // assigns global variables return newItem; which is probably not what you wanted) To do what you want (which I assume is creating a new object), you need to … Read more