fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> </head> <body> <h1>使用 "use strict":</h1> <h3>不允许对只读属性赋值。</h3> <p>浏览器按下 F12 开启调试模式,查看报错信息。</p> <script> "use strict"; var obj = {}; Object.defineProperty(obj, "x", {value:0, writable:false}); obj.x = 3.14; // 报错 </script> </body> </html>
运行结果