JavaScript

What is the difference between `null` and `undefined`?

Easy
5
Added
`undefined` means a variable is declared but not assigned. `null` is an assigned value representing no value.

Solution Code

JavaScript
let a; console.log(a); // undefined
Explanation
undefined is the default value for uninitialized variables while null must be explicitly assigned.

Guided Hints

Check JavaScript type system
What does typeof return for each?