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

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);

 

求助,幫忙解釋一下執行結果,或者是有興趣的園友共同討論。測試

在此,我附上執行結果:this

測試啦
red undefined
undefined "coyote"
5 5
undefined "執行上下文"
spa

trueprototype

falsecode

 我屢次嘗試,因爲文字太少,不能發送到首頁和候選區,也不知諸位大神和各位園友何時能看到,不過在您看到這篇文章的時候,無論我是否已經解決問題,都歡迎各位發表評論,我們共同討論。blog

相關文章
相關標籤/搜索