How to copy the js function if there are many parameters?

for example, a function fn

is now encapsulated.
const fn = (a,b,c,d,e,f) => {
  console.log(a,b,c,d,e,f)
}

for example, in the above function, I defined seven parameters, but when the function is more complex, it sometimes results in missing parameters. I now think of the possibility of passing values with objects, but I don"t have a particularly clear idea of how to implement them. Ask experienced friends to elaborate on ~

Feb.12,2022

. learn about the extension operator:

const fn = (...args) => {
  console.log(...args)
}

 

function deliverParams ((
console.log)
}
deliverPrarams ({
br > deliverPrarams ({
br >})

in this way, the parameter calls in the function will not be confused due to the lack of passing parameters, but it can clearly let us know what parameters are passed (after all, it is not messy in the form of key-value when there are many parameters)

Menu