Usually, as my code base grows, the functions recieve more and more arguments and it becomes a little sloppy to maintain, so I usually just default to something like this:
f = function(args){return args.v + 1;}
f({"v":2});
It looks way more cleaner, but is it OK to do? Why isn’t everyone doing this?
“it looks way more cleaner, but is it OK to do?”
Yes.
“Why isn’t everyone doing this?”
Aren’t they though? This is standard practice for the most common “many parameter” situation in Javascript: passing options. Since there’s no overhead to creating a one-off object in Javascript, it’s common practice when you have more than a couple parameters.