源代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>享学课堂</title> </head> <body> <h1>JavaScript 赋值</h1> <p>JavaScript中使用=操作符给变量赋值.</p> <p id="demo"></p> <script> var x, y; x = 5; y = 6; document.getElementById("demo").innerHTML = x + y; </script> </body> </html>
运行结果