Just a style question.
do you people prefer to pass in variables into a function like
function (a, b) {
return a + b;
}(1,2);
or
function (args){
return args.a + args.b;
}({a:1;b:2});
?
Are there any performance issues between the two?
I'm deciding on standardizing my functions in some way, therefore I'm asking this question.
If it's just a few parameters I would use the first for better readability (documentation).
If there are a lot of parameters, I would use the second one (for example options object).
I don't think there's any major performance difference between the two.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With