码迷,mamicode.com
首页 > 其他好文 > 详细

new function

时间:2017-12-17 23:42:54      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:关系   this   ons   prototype   cti   struct   new   his   blog   

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script>
// var F=function(){};
// Object.prototype.a=function(){};
// Function.prototype. b=function(){};
// var f=new F();
// f.a;
// f.b;


function Person(){}
var friend = new Person();
 
Person.prototype = {
    constructor : Person,
    name : "kayorl",
    sayName : function () {console.log(this.name);}
}
 
friend.sayName(); //ERROR
</script>
小红书 P156页,可知原型修改后, 切断了原来原形与 更改后原形的关系
</body>
</html>

new function

标签:关系   this   ons   prototype   cti   struct   new   his   blog   

原文地址:http://www.cnblogs.com/qdcnbj/p/8053659.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!