<script> var num1 = prompt('请输入数值1'); var num2 = prompt('请输入数值2'); function num(num1,num2){ return Number(num1) + Number(num2); } var aru = num(num1,num2); console.log(aru); alert('结果是' + Number(aru)); </script>
<script> var num1 = prompt('请输入数值1'); var num2 = prompt('请输入数值2'); function num(num1,num2){ return Number(num1) + Number(num2); } var aru = num(num1,num2); console.log(aru); alert('结果是' + Number(aru)); </script>