首页 > 其他 > 详细

给Object扩展新方法

时间:2015-10-11 22:57:25      阅读:270      评论:0      收藏:0      [点我收藏+]
 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>关于hasOwnProperty()方法的应用</title>
 6 </head>
 7 <body>
 8    <script>
 9 if (typeof Object.prototype.clone === "undefined") {
10    Object.prototype.clone = function () {
11     alert(this.b)
12    };
13 }
14 var a ={b:1}
15 a.clone()
16    </script> 
17 </body>
18 </html>

 

给Object扩展新方法

原文:http://www.cnblogs.com/suoking/p/4870156.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!