题解 | #模块#
模块
http://www.nowcoder.com/practice/48e53feaabe94506a61300edadb5496d
// 动态原型方式 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 }