运行 ❯
获取您的
自有
网站
×
更改方向
保存代码
更改主题,暗色/亮色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Objects</h1> <h2>The Object.defineProperty() Method</h2> <p>This example changes a property value.</p> <p id="demo"></p> <script> // Create an object: const person = { firstName: "John", lastName: "Doe", language: "EN" }; // Change a property Object.defineProperty(person, "language", {value:"NO"}) // Display Property document.getElementById("demo").innerHTML = person.language; </script> </body> </html>