Logo InterviewVault

Welcome back, Sujit Kumar Mishra

SKM

Revision Mode

Document technical questions and best-practice answers.

Cancel

What is the difference between undefined and NULL? 

Difference between undefined and NULL:

1: undefined means a variable has been declared, but no value has been given to it yet.

Think: "I don’t know what this is yet."

2: NULL means a variable has been given a value, and that value is "nothing" or "empty."

Think: "I know this is nothing."


Summary:

1: undefined = not assigned any value

2: NULL = assigned to be empty on purpose

Ready for commit