两个数字字符串相加会产生连接的字符串
- <!DOCTYPE html>
- <html>
- <body>
- <h1>JavaScript 数字</h1>
- <p>如果添加两个数字字符串,结果将是级联字符串:</p>
- <p id="demo"></p>
- <script>
- var x = "10";
- var y = "20";
- var z = x + y;
- document.getElementById("demo").innerHTML = z;
- </script>
- </body>
- </html>