Function default parameter value
Starting from ES2015 JavaScript update, you can set default value to your function parameters using the following syntax:
The default parameter is applied in two and only two situations:
- No parameter provided
- undefined parameter provided
In other words, if you pass in null the default parameter won't be applied.
Note: Default value assignment can be used with destructured parameters as well (see next notion to see an example)