getInput=function(){ var str return /\d+/.test(str=prompt("print number: ")) ? +str : function(){alert("incorrect input; try again, please"); return getInput()}() } alert(getInput()+getInput())