<!DOCTYPE html> <html> <body> <h1>JavaScript 对象</h1> <p>显示对象属性:</p> <p id="demo"></p> <script> const person = { name: "Bill", age: 19, city: "Seattle" }; let txt = ""; for (let x in person) { txt += person[x] + " "; }; document.getElementById("demo").innerHTML = txt; </script> </body> </html>