var sum1 = prompt("请输入第一个数字") * 1;
var sum2 = prompt("请输入第二个数字") * 1;
var sum = sum1 + sum2;
console.log("两者之间的和为" + sum);
<html>
<head>
<meta charset="utf-8">
<body>
<script src="./ch05-2.js"></script>
</body>
</head>
</html>
![](https://img2023.cnblogs.com/blog/3119991/202303/3119991-20230314091659132-207667984.png)
![](https://img2023.cnblogs.com/blog/3119991/202303/3119991-20230314091707963-477210642.png)
![](https://img2023.cnblogs.com/blog/3119991/202303/3119991-20230314091713214-1539175268.png)