a.js這是node導出一個類let Person = function () {this.name = '張三;}Person.prototype = {constructor:Person,
say:function () {
console.log('my name is '+this.name);
}};module.exports.Person = Person;b.js引用a.js文件let Person = require("./a.js");let person = new Person('張三');console.log(person.say());為什么最后輸出 my name is 張三 和undefined
- 1 回答
- 0 關注
- 1198 瀏覽
添加回答
舉報
0/150
提交
取消