在学习插件封装时,下面两种原型继承开发的区别是什么?
function Dialog(){}
Dialog.prototype.fun1 = function(){
console.log("fun1");
}
Dialog.prototype.fun2 = function(){
console.log("fun2");
}
Dialog.prototype = {
constructor: this,
fun1:function(){
console.log("fun1");
},
fun2:function(){
console.log("fun2");
}
}
第一个是在现有链上添加东西,第二种是指向另外一条链
另外,你的
this
是什么鬼