JS: default parameter

Set optional parameters to your function so you can call it with or without arguments!

With default parameters in ES2015, checks in the function body are no longer necessary as per the example shown below:

function AnyFunction(pickUpThisClass) {
    pickUpThisClass=    typeof (pickUpThisClass) !== 'undefined' ?
                        pickUpThisClass :

Now, you can assign the default value in the function head:

function multiply(a, b = 1) {
  return a * b

multiply(5, 2)          // 10
multiply(5)             // 5
multiply(5, undefined)  // 5

More info on MDN Web Docs: