Say I have a file class.js
:
class myClass {
constructor(arg){
console.log(arg);
}
}
And I wanted to use the myClass
class in another file. How would I go about this?
I've tried:
var myClass = require('./class.js');
But it didn't work.
I've looked at module.exports
but haven't found an example that works for es6 classes.