Monday, June 3, 2024
150
rated 0 times [  153] [ 3]  / answers: 1 / hits: 17632  / 7 Years ago, mon, november 13, 2017, 12:00:00

Example :



const foo = {a: A, b: B}
const {a, b} = foo


What if I want b to be a variable using let ?


More From » ecmascript-6

 Answers
4

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;

[#55948] Thursday, November 9, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dylondarrianb

Total Points: 48
Total Questions: 109
Total Answers: 104

Location: Zambia
Member since Thu, Jun 25, 2020
4 Years ago
dylondarrianb questions
;