Frage im Vorstellungsgespräch bei IBM

What is the difference between null and undefined in JavaScript?

Antwort im Vorstellungsgespräch

Anonym

4. Juni 2024

null represents an intentional absence of any value, while undefined indicates that a variable has been declared but hasn’t been assigned any value. null is a value that can be explicitly assigned, whereas undefined is the default value for uninitialized variables.