Named Arguments

In ES2015, parameter destructuring can be used to simulate named parameters.
Using named arguments is much better than using positional arguments.
Destructuring Arguments


//destructuring to assign parameters 
let myFunc = function({x,y,z}) {
    console.log(x,y,z);
};

myFunc({x:10,y:20,z:30}); //10 20 30


© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited TopPrevNext