I have a file. a.js
class A{
constructor(name){
this.name = name;
}
displayName(){
console.log(this.name);
}
}
module.exports = Render;
Another file common.js
const A = require('./a');
exports.A;
Another file b.js
const common = require('./common');
var a = new common.A('My name is khan and I am not a terrorist');
a.displayName();
I am getting an error A is not a constructor. Please help, how can get it done. Please forgive my silly mistakes, I am newbie.
via Imran
No comments:
Post a Comment