Sorry I know this is really a dumb question, but I couldn't find the answer after a couple of rounds googling. Code looks like below:
let x = 0
// After some calculation I know the obj should be:
const obj = {'x': 1 }
// Then how to destructuring assigment at this line
{ x } = obj // this is incorrect
// But if I use: x = obj.x, ESLint warns me: [eslint] Use object destructuring. (prefer-destructuring)
console.log(x);
So my question is how to use destructuring assignment after x
has been defined.