While doing destructring in JavaScript, varable should be same as property name of an object? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

While doing destructring in JavaScript, varable should be same as property name of an object?

Please See the code here. https://code.sololearn.com/W85bxXmy98HU/?ref=app

3rd Mar 2019, 2:16 AM
Chandra Sekhar Ravuri
Chandra Sekhar Ravuri - avatar
1 Answer
+ 1
It's not mentioned explicitly here in ES6 section of JS course but it seems so. BTW, if you want to use another variable, you can do something like let {h:a, s:b} = obj; console.log(a) console.log(b)
3rd Mar 2019, 2:31 AM
Шащи Ранжан
Шащи Ранжан - avatar