简单教程
提交运行
代码编辑器:
<p>你可以在一个语句中声明多个变量:</p> <button onclick="myFunction()">点我</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>
运行结果: