I have this in MyClass.js:
function MyClass(name) {
this.Name = name;
}
module.exports.MyClass = MyClass;
And I have this in Main.js:
var MyClass = require('./MyClass');
var obj = new MyClass('Something');
console.log(obj.Name);
But I'm getting the error TypeError: Object is not a function
happening on the 'n' of new.
How can I define a class in another file in nodejs? I feel like this should have worked just fine, but it doesn't.