Answer the question
In order to leave comments, you need to log in
Pros and cons of passing parameters by an object?
Faced with the need to pass the function 5+ string parameters and an object. I thought about it and began to transfer everything as a single object, from which I pull out the values \u200b\u200band necessary in the function and object data.
vs.function (a,b,c,d,e,Object) {...};
function ({
a: a,
b: b,
......
obj: Object[]
}) {...};
Answer the question
In order to leave comments, you need to log in
There are no minuses, everything you thought was right, usually with four parameters or more, they already use an object to pass parameters.
Quote from Mat Zanderstra. .. assigning properties to objects is considered bad form in OOP and is almost never used.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question