I am new to the world of Javascript and am tinkering with writing very basic functions and stumbled upon the example below by accident and am unsure why it works when I am n
If you omit the argument, its value will be undefined
. This enables you to create optional parameters quite easily.
Another feature is the ability to define a function with no parameters, and call it with arguments successfully, making use of the arguments
object. This lets you easily create variable-length argument arrays.