Chapter 2: Clean Code with ES6 Default Parameters & Property Shorthands
by Moritz Kröger
Creating a method also means writing an API — whether it’s for yourself, another developer on your team, or other developers using your project. Depending on the size, complexity, and purpose of your function, you have to think of default settings and the API of your input/output.
ES6 Default Parameters
Let’s freshen up our knowledge quickly and take a look at the syntax again. Default parameters allow us to initialize functions with default values. A default is used when an argument is either omitted or
undefined — meaning
null is a valid ...