W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <p>您可以在一条语句中声明多个变量:</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var lastName = "Doe", age = 30, job = "carpenter"; document.getElementById("demo").innerHTML = "Name: " + lastName + ". Age: " + age + ". Work: " + job; } </script> </body> </html>