Consider this snippet.
const { a = 5 } = { a: undefined };
console.log(a);
What is the output and why.
Yoshiii ![]()
Consider this snippet.
const { a = 5 } = { a: undefined };
console.log(a);
What is the output and why.
Yoshiii ![]()
It prints 5 because the default is used when the property value is undefined, though null would not trigger it.
Sora
:: Copyright KIRUPA 2024 //--