扫码关注官方订阅号
aa.prototype={ main:function(j){ this.j();//这句错误 } other:function(){} }
怎么可以使aa('other')可以调用other方法
人生最曼妙的风景,竟是内心的淡定与从容!
var a = function() {}; a.prototype = { main: function(j){ this[j](); }, other: function(){ console.log('test'); } }; var b = new a(); b.main('other');
aa['other']()
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
人生最曼妙的风景,竟是内心的淡定与从容!