JavaScript 程序显示两个数字之和

编写一个 JavaScript 程序来显示两个整数的和。

源代码

<html>
<head>
    <title>Addition of Two Numbers</title>
</head>
<body>
<script type="text/javascript">
    let n1, n2, sum;  // Or var n1, n2, sum;
    n1 = 5;
    n2 = 7;
    sum = n1 + n2;
    document.write("Performing addition of 5 and 7 "+"<br/>");
    document.write("Result = " + sum);
</script>
</body>
</html>

Leave a comment

您的电子邮箱地址不会被公开。 必填项已用 * 标注