3 ms·
Generally speaking, in the JS world at least, if you're passing more than a few parameters into a function you might have code complexity problems. If you need
by Wintamute 13y ago
Generally speaking, in the JS world at least, if you're passing more than a few parameters into a function you might have code complexity problems. If you need to pass in a bunch of data to a function you tend to do it in a single options object with some runtime checking to work out what to do with it. Any remaining problems should be caught with good test coverage. Being able to flexibly and clearly handle variable numbers of function arguments without getting entangled in an involved function overloading syntax and methodology is actually sometimes pretty nice. It's a feature not a problem. Haha :P
- forgottenpass 13y ago>>How do you handle Javascript ignoring wrong numbers of function arguments? >if you're passing more than a few parameters into a function I didn't know you had to have "more than a few parameters" before you could make a coding error related to the number of parameters you pass something.