+ 1

Destruction is real?

After destruc an array, the array still exist ? or not?

14th Jun 2020, 8:52 PM
Alain Mazy
Alain Mazy - avatar
5 Antworten
+ 4
It is not destruction. It is destructuring. What it does is that it assign the object's values into individual variables. The original object is not mutated at all. For example const obj = { name: 'Ore', age: 'Nil', gender: 'M' } const {name, age, gender} = obj; console.log(name); //Ore console.log(obj.name); //Ore Try ro run the code and see fir yourself
14th Jun 2020, 9:23 PM
Ore
Ore - avatar
+ 1
Allright, Sorry for my confusion, I'm probably wrong because I don't understand 100% English and I regularly use google trad. :)
18th Jul 2020, 12:18 PM
Alain Mazy
Alain Mazy - avatar
0
Thank, It is just the destructor term which is badly chosen, that only extracts the pair key:values or unroll the array in var list without touch original array. in first case, it properties acces and after unroll accès is direct like vars. it's correct?
15th Jun 2020, 7:17 AM
Alain Mazy
Alain Mazy - avatar
0
Alain Mazy It is called destructure not destructor. Destructor is a term used in OOP to define a method that is called when an object lifecycle has ended.
15th Jun 2020, 8:15 AM
Ore
Ore - avatar
0
Alain Mazy No problem
18th Jul 2020, 12:35 PM
Ore
Ore - avatar