// 动态原型方式 function createModule(str1, str2) { const obj = {} obj.greeting = str1 obj.name = str2 if(typeof sayIt !== 'function') { obj.sayIt = function() { return this.greeting + ', ' + this.name } } return obj }