Destructuring
according to the rules of destructuring , an array of values can be assigned to an array of variables

    [a, b, c] = [10, 20, 30];                       
    //a=10, b=20, c=30
    
    [a,b,...vars] = [10, 20, 30, 40, 50];           
    //a=10, b=20, vars = [30, 40, 50]
    
    ({a,b, ...vars} = {a:10, b:20, c:30, d:40})  
    //a=10, b=20, vars {c:30, d:40}
    
    ({b,a, ...vars} = {a:10, b:20, c:30, d:40})  
    //will return the exact same assignments 
    //(in object the order does not matter)
    
back to main page