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 关注
- 1176 浏览
添加回答
举报
0/150
提交
取消