Naming Shattered Argument Objects

With ES6, you can destroy argument objects as follows:

function myFun ( {val1, val2, val3} ) {
    console.log("easy access to individual entries: ", val2);
}

But is it possible to name the entire object of the argument at the same time so that I can refer directly to this? I tried using the "arguments" object for this purpose, but with little success (I will save this specific problem for another question here if necessary)

+4
source share

Source: https://habr.com/ru/post/1612038/


All Articles