Learn how to set default parameter values for JavaScript functions.
Read on how to do it in this tutorial: https://www.w3schools.com/howto/howto_js_default_parameters.asp
Default Parameters
If a function in JavaScript is called with missing arguments (less than declared), the missing values are set to undefined
.
Sometimes this is acceptable, but sometimes it is better to assign a default value to the parameter.
Try it yourself here: https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_default_parameters
Read more about functions in our JavaScript Function Tutorial.