Object.getOwnPropertyNames()方法
- 2017-06-21 11:20:00
- admin 原创
- 369
<!DOCTYPE html> <html> <head> <title>Object.getOwnPropertyNames() Example</title> <script type="text/javascript"> function Person(){ } Person.prototype.name = "Nicholas"; Person.prototype.age = 29; Person.prototype.job = "Software Engineer"; Person.prototype.sayName = function(){ alert(this.name); }; var keys = Object.getOwnPropertyNames(Person.prototype); alert(keys); //"constructor,name,age,job,sayName" </script> </head> <body> <p>Note: this example only works in browsers that have implemented the ECMAScript 5 <code>Object.defineProperty()</code> method (IE9, Firefox 4, and Chrome 7).</p> </body> </html>
文章分类
联系我们
电话: | 18902328227 |
---|---|
Email: | 2689701946@qq.com |
QQ: | 2689701946 |
微信: | 18902328227 |
地址: | 广州番禺区繁华路 |