Default Parameters in JavaScript: Beginners Guide
Too Long; Didn't Read
This article assumes you have some familiarity with coding in the JavaScript ecosystem. In this short article we will cover Function Defaults and learn how to use it in our day to day JavaScript programming. We learned how to set sane default values for the parameters in our JavaScript functions. You can also use function defaults one step further by using another parameter as the default. The product() function just squares the first parameter if the second one isn’t provided. The result is that your code just runs without the correct parameters.