各位大神求助:执行上下文

console.log("测试啦");
  var a0 = new a();
  function a(){
    this.num = 5;
  }
  a.prototype.color = "red";
  a.prototype = {
    name : "coyote",
    age : "不告诉你"
  }
  a.prototype.tes = "执行上下文";
  var a1 = new a();
  console.log(a0.color,a1.color);
  console.log(a0.name,a1.name);
  console.log(a0.num,a1.num);
  console.log(a0.tes,a1.tes);
 console.log(a1.__proto__ === a.prototype);
  console.log(a0.__proto__ === a.prototype);

求助,帮忙解释一下执行结果,或者是有兴趣的园友共同讨论。

在此,我附上执行结果:

测试啦
red undefined
undefined "coyote"
5 5
undefined "执行上下文"

true

false

 我多次尝试,由于文字太少,不能发送到首页和候选区,也不知诸位大神和各位园友什么时候能看到,不过在您看到这篇文章的时候,不管我是否已经解决问题,都欢迎各位发表评论,咱们共同讨论。

 
原文地址:https://www.cnblogs.com/coyote/p/6126254.html