Example :
const foo = {a: "A", b: "B"}
const {a, b} = foo
What if I want b
to be a variable using let
?
It seems like you can't differentiate variable's declaration in a one line. However, you could split it into two lines and use a different variable declaration, depends on which variable you want to get.
const { a } = foo;
let { b } = foo;