+ 1
Destruction is real?
After destruc an array, the array still exist ? or not?
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
+ 1
Allright, Sorry for my confusion, I'm probably wrong because I don't understand 100% English and I regularly use google trad. :)
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?
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.
0
Alain Mazy No problem