Is it possible to use a destructoring assigment when invoking a function?
Something like this:
function myFunc(one, two) { ... }
const functionArgs = {
    one: 1,
    two: 2
}
myFunc(...functionArgs);
Is it possible to use a destructoring assigment when invoking a function?
Something like this:
function myFunc(one, two) { ... }
const functionArgs = {
    one: 1,
    two: 2
}
myFunc(...functionArgs);
 
    
    Destructuring objects won't work but you can spread arrays.
function myFunc(one, two) { 
  console.log(one, two)
 }
const functionArgsObj = {
    one: 1,
    two: 2
}
const functionArgsArr = [
    1,
    2
]
// myFunc(...functionArgsObj); throws error
myFunc(...functionArgsArr); // works as expected (output: 1, 2)