Following on Is there a way to provide named parameters in a function call in JavaScript?
I'm doing something like this:
function myFunction({param1, param2}={}){
// ...function body...
}
myFunction({ param1 : 70, param2 : 175});
So i was wondering is there a way to do this:
function myFunction(params = {param1, param2}={}){
doSomething(...params)
}
I think its clear i want to be able to spread the parameter object inside another function instead of specifying each parameter, but doing it like
params = {param1, param2}={}
will result in errors saying param1
and param2
are not defined!, so i know this is not the way, so any idea how this can be achieved or maybe its not possible in the first place?