Problem Statement
Which is true about null and undefined in JavaScript?
Explanation
undefined is the default value for uninitialized variables or missing properties.
null is an explicit assignment indicating 'no value'. Note: typeof null returns 'object' due to a historical quirk.
Code Solution
SolutionRead Only
let a; const b = null; console.log(a === undefined); // true console.log(b === null); // true console.log(typeof null); // 'object'
Practice Sets
This question appears in the following practice sets:
