<!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>

相关文章:

  • 2022-12-23
  • 2021-09-07
  • 2021-05-22
  • 2022-01-13
  • 2022-12-23
  • 2022-12-23
  • 2022-03-09
猜你喜欢
  • 2021-12-31
  • 2022-12-23
  • 2021-10-19
  • 2022-12-23
  • 2021-10-04
  • 2021-08-03
相关资源
相似解决方案