I have a file that contains this :
// filename "Test1"
module.exports = class Test {
constructor() {
console.log('Instancied !');
}
}
I have a second file that contains this
// filename "Test2"
const Test = require('./Test1');
const testInstance = new Test();
Is there a way to simplify this to create the class in the same line as the require?
This doesn't works but I'm thinking that is can looks like this : const testInstance = new (require('./Test1'));