1 2 3 4 5 6 7 8
var sum = function(a, b) { return parseInt(a || 0) + parseInt(b || 0); }; var a = prompt(); var b = prompt(); alert(sum(a, b));