a.js
this is node to export a class
let Person = function () {
this.name = ";
}
Person.prototype = {
constructor:Person,
say:function () {
console.log("my name is "+this.name);
}
};
module.exports.Person = Person;
b.js
reference a.js file
let Person = require (". / a.js");
let person = new Person ("Zhang San");
console.log (person.say ());
Why did you finally output my name is Zhang San and undefined