destructure a variable code example
Example 1: destructuring assignment
Destructuring assignment is special syntax introduced in ES6,
for neatly assigning values taken directly from an object.
const user = { name: 'John Doe', age: 34 };
const { name, age } = user;
// name = 'John Doe', age = 34
Example 2: destructured object
let renseignement = ['voleur' , '10' , 'spécialité'] ;
let [classe , force, magie] = renseignement ;
console.log(classe) ;
console.log(force) ;
console.log(magie) ;