One line answer to your question is that, it returns null when user has escaped the prompt box by clicking cancel or pressing escape.
For further clarification of concepts read this :-
This is formal defiinition of function:
result = window.prompt(message, default);
result : is a string containing the text entered by the user, or null.
message : is a string of text to display to the user. This parameter is optional and can be omitted if there is nothing to show in the prompt window.
default : is a string containing the default value displayed in the text input field. It is an optional parameter. Note that in Internet Explorer 7 and 8, if you do not provide this parameter, the string "undefined" is the default value.
(Above was from Mozilla's definition of prompt())
Now we Conclude that:
prompt() returns either null or "string" which can include ""(empty string).
Now We have three states to inspect:
null : The user has clicked Cancel or pressed Esc.
""(empty string) : The user clicked OK or pressed Enter with no text input
"string" : The user entered some text.
hope it helps...!