Empty vs Null vs Undefined
A simple reference table for common empty, blank, missing, and empty-like values.
0 and false are real values, while null, undefined, and missing keys usually mean absent or unavailable data.
| Value | Type | Context | Example |
|---|---|---|---|
null |
Explicit empty value | A deliberate absence of a value. Common in JSON, APIs, databases, and programming languages. | {"name": null} |
undefined |
Not assigned | A value has not been assigned or does not exist. Common in JavaScript. | let value; |
"" |
Empty string | A string exists, but it contains no characters. | {"name": ""} |
[] |
Empty array | A list exists, but it contains no items. | {"items": []} |
{} |
Empty object | An object exists, but it contains no properties. | {"data": {}} |
0 |
Zero | A real numeric value. It is empty-like in some loose checks, but it is not missing. | {"count": 0} |
false |
Boolean false | A real boolean value. It is empty-like in some loose checks, but it is not missing. | {"active": false} |
NaN |
Invalid number | Means Not-a-Number. Usually appears when a numeric calculation or parse fails. | Number("abc") |
Whitespace |
Blank-looking string | A string with spaces, tabs, or line breaks. It may look empty but still contains characters. | " " |
Missing key |
Absent field | The field does not exist at all. Different from a field that exists with null or empty string. | {"email": "a@example.com"} |