工厂模式

110 阅读1分钟

   
        function show(name, age, job) {
            var str = new Object();
            str.name = name;
            str.age = age;
            str.job = job;
            str.showInfo = function () {
                document.write(this.name, this.age, this.job)
            }
            return str
        }
        var qwe = show('吊凯', '18', '游戏')
        qwe.showInfo()
  
</body>

</html>