For a longer time I've asked myself if there's a real difference between these 3 methods of exporting an entire class in Node.js. Is there a "correct" way or any differences within the different kind of methods?
Let's say we have this example class:
class Foo {
constructor() {
this.name = 'foobar';
}
bar() {
console.log(this.name);
}
}
What would be the correct way of exporting this class in a Node.js environment?
module.exports = new Foo();
or
module.exports = new Foo;
or
module.exports = Foo;
Thanks a lot for any answers in advance!