Skip to main content

Difference between null and undefined.

Entry JavaScript
Quick Answer undefined: variable declared but no value assigned, or missing function return, or missing object property. null: explicitly assigned to mean "no value" รขโ‚ฌโ€ intentional emptiness. typeof undefined is "undefined"; typeof null is "object" (historical bug). null === undefined is false; null == undefined is true.

Answer

null: intentional empty value.

undefined: declared but not assigned.

S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice