re: Default Function Parameters (ES6) VIEW POST

VIEW FULL DISCUSSION
 
If you don't specify an argument, the default value of the parameters gets used.

What if I specify an argument with an undefined value?

 

Good question!!, the same thing applies. The only difference in this case is that you are explicitly setting your argument to be undefined. The trick here is, whether you specify undefined explicitly or allow JavaScript to do it for you implicitly, the important thing to note is that once JavaScript reads undefined it uses the default parameters

 

undefined logically means that you are not specifying the argument. So it will use default value.

code of conduct - report abuse