Code implementation
function mixExtend( o1, o2 ){ for( var key in o2 ){ o1[key] = o2[key]; } return o1; } ----------//调用一下var o1 ={}; mixExtend( o1, { name:"二狗",age:18,say:function(){ console.log("大家好,我是二狗"); } }); console.log(o1);
Related recommendations:
Parasitic inheritance of JS inheritance
Sharing of several js inheritance styles
##js Inherited implementation code_javascript skills
The above is the detailed content of Detailed explanation of js mixed inheritance examples. For more information, please follow other related articles on the PHP Chinese website!