What is the difference between null and undefined in JavaScript?

JavaScript Associate Easy

JavaScript Associate — Easy

What is the difference between null and undefined in JavaScript?

Key points

  • Undefined indicates a variable has been declared but not assigned a value
  • Null is a deliberate assignment representing no value
  • Understanding this distinction helps avoid unexpected behavior in code

Ready to go further?

Related questions