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 :
'default-class';
console.log(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:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters