I have a problem, or more some weird situation. I am using https://es6console.com.
I want to use destructuring and assign properties to already declared variables. It looks like that there is a problem in where I declare object. Please open https://es6console.com/jm6e72c7/ and click Transform to ES5. There is a weird behaviour where I declare object after variables.
// not working
let ip, port;
let config = {
ip: 'ip',
port: 'port'
}
({ip, port} = config)
console.log(ip);
//working
let obj = {
name: 'name',
age: 'age'
}
let name, age;
({name, age} = obj)
console.log(name);