function multiply(a, b) {
b = (typeof b !== 'undefined') ? b : 1
return a * b
}
function sum(x = 1, y = x, z = x + y) {
console.log( x + y + z );
}
sum(); // 4
// using a function in default value expression
const sum = () => 15;
const calculate = function( x, y = x * sum() ) {
return x + y;
}
const result = calculate(10);
console.log(result); // 160