0

I am coming from python and trying to learn JavaScript. I noticed that when, by accident, I tried to call a function with the wrong number of arguments, it didn't raised an error and just returned Nan.

What's the explanation for this behavior?

EDIT: Get warning when passing too few arguments to a javascript function

This is exaclty what i was looking for, thank you @Code-Apprentice

vonkov
  • 11
  • 2

1 Answers1

0

You should add an example or code part of what you mean when you're asking a question. Anywayyyy... For your question you can read about this here.

TL;DR?

Parameter Rules

JavaScript function definitions do not specify data types for parameters.

JavaScript functions do not perform type checking on the passed arguments.

JavaScript functions do not check the number of arguments received.

snatchysquid
  • 1,283
  • 9
  • 24
  • W3Schools is not a very good reference. [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters) is better – mplungjan May 31 '20 at 21:19