源代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>享学课堂</title> </head> <body> <p>当添加一个数字和一个字符串,JavaScript将数字作为字符串处理.</p> <p id="demo"></p> <script> var x = 16 + "Volvo"; document.getElementById("demo").innerHTML = x; </script> </body> </html>
运行结果