<script> //创建工厂 var mbfactory={ createbike:function () { return new macbike(); } } function macbike() {} macbike.prototype={ constructor:macbike, getmb:function () { console.log('hahahahahah') } } var gg=mbfactory.createbike(); gg.getmb(); </script>
js的简单工厂模式
最新推荐文章于 2021-09-11 13:08:31 发布