Do you know what will be the output of this code?
JavaScript
function f(x = 10) {
return x;
}
console.log(f(undefined), f(null));
Show answer and explanation
The answer is 10 null.
A default value is used only when the argument is missing or undefined. null is a real value, so it’s passed through.