What gets logged?
const { x = 5 } = { x: null };
console.log(x);
- 5
- null
- undefined
- TypeError
0
voters
What gets logged?
const { x = 5 } = { x: null };
console.log(x);
It logs null — the default only applies when the property is undefined, not when it’s present-but-null.
const { x = 5 } = { x: null };
console.log(x); // null
:: Copyright KIRUPA 2024 //--