W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <h1>JavaScript 显示对象属性</h1> <p>对象的属性可显示为字符串</p> <p id="demo"></p> <script> const person = { name: "Bill", age: 19, city: "Seattle" }; document.getElementById("demo").innerHTML = person.name + "," + person.age + "," + person.city; </script> </body> </html>