JavaScript Cancel on Prompt
<p>Hi I was wondering what the difference between the prompt() method and confirm() methods are? </p>

<p>and also: I was wondering how to modify the following code, so that when the user cancels the prompt box, a block of code is executed.</p>

<pre><code>var userInput = prompt("Write your name","");
if(prompt == //user cancels//){
code to be executed;
}
</code></pre>

<p>Thanks.</p>