Default parameter
Gives a parameter a default value.
Syntax
function name(x, y = default) { }Description
If no argument is provided, the default is used.
Example
Loading editor…
Expected output
Hello Alex
When to use?
Optional settings, frequently repeated arguments.