Problem: If a function accepts two arguments of the same type, people may...


Problem:
If a function accepts two arguments of the same type, people may pass arguments in the wrong order.

Solution:
Accept an object instead.

Then:
✅ Order doesn’t matter.
✅ You can easily add arguments later.
✅ The function's signature is simple, even with many args.

Don't want to repeat the object's name?

Then destructure:

View original on X