I have two option in prompt, acept and cancel, here is ok, but when I do cancel in prompt, this generate a list of anyway, why not function?
add.onclick = function(){
if(true) {
var itemText = prompt('Create a Memo');
}else {
return false;
}
var question = prompt('Create a memo');
if(question) {
alert('true - ' + question);
} else {
alert('false - ' + question);
}
Another example:
var question = prompt('Create a memo');
if(question) {
document.getElementById('text').innerHTML = 'I answered ' + question;
} else {
document.getElementById('text').innerHTML = 'I canceled';
}