Home > Mobile >  Why not program gives an error. As two parameters were required I have pass only one parameter and i
Why not program gives an error. As two parameters were required I have pass only one parameter and i

Time:07-06

enter image description here Image that I have paste here. As I have pass only one argument as parameter as two were required then why this function works and why not it gives us a error

CodePudding user response:

You are returning 23, the function doesn't utilize both a and b, and therefore won't produce an error for not using both.

CodePudding user response:

JavaScript function parameter rules:

  • JavaScript functions do not perform type checking on the passed arguments.
  • JavaScript function definitions do not specify data types for parameters.
  • JavaScript functions do not check the number of arguments received.
  • Related