Hello. I study programming and javaScript.

I break a large function into small ones. There was a difficulty with checking the arguments.

Unclear questions like:

  • Is the calling or called function responsible for what types of arguments and their number match the expected ones?
  • When to check arguments and when can I omit it?
  • How to validate types?
  • etc.

The natural question has ripened: are there any generally accepted (or not generally accepted) agreements to this effect?

  • what kind of check? type checking? - Mikhail Vaysman
  • @MikhailVaysman type checking and quantity (the presence of all necessary arguments). - Pavel Zubkov
  • add this to the question. - Mikhail Vaysman

0