<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <script> var person={}; Object.defineProperties(person,{ one:{value:30,}, two:{value:303,enumerable:true,configurable:true} }); var s=Object.getOwnPropertyDescriptor(person,'two'); document.write(s); </script> </body> </html>
试试这样
document.write(s);
改为:
document.write(JSON.stringify(s));
直接控制台打印,console.log(s)
看看person对象 写的有没有问题?