亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

javascript 函數返回的問題,請教各位高手。

javascript 函數返回的問題,請教各位高手。

fshang 2018-08-28 13:25:52
function aFun(){function _(arg){this.arg = arg;}_.prototype.testFun = function(){console.log('this is prototype testFun')};_.testFun2 = function(){console.log('this is testFunc2');}return _;};var afun = new aFun('123');console.log(afun instanceof aFun)afun.testFun2(); //可以調用afun.testFun(); //不是在原型鏈上么?,為啥不可以調用???,var aFun2 = (function (){function _(arg){this.arg = arg;}_.prototype.testFun = function(){console.log('this is prototype testFun')};_.testFun2 = function(){console.log('this is testFunc2');}return _;})();var afun2 = new aFun2('ddd');console.log(afun2 instanceof aFun2)afun2.testFun2(); //不可以調用,為啥?afun2.testFun(); //可以調用,為啥可以?(我要瘋了)
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關注
  • 147 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號