Limiting the amount of function arguments
It is very important and useful to limit the amount of function arguments, because it makes testing your function easier. Having more than three leads to a combinatorial explosion where you have to test tons of different cases with each separate argument. Using a object if you can’t avoid a situation requires more than 3 arguments.
Bad:123function createMenu(title, body, buttonText, cancellable) { // ...}
Good:12345678910function createMenu({ title, body, buttonText, cancellable }) { // ...}createMenu({ title: 'Foo', body: 'Bar', buttonText: 'Baz', cancellable: true});