Noob in JS here.
Let’s say I have a js file where the contents are like
function a(){}
a.prototype.method1 = function() { ... };
a.prototype.method2 = function() { ... };
function b(){}
b.prototype.method3 = function() { ... };
b.prototype.method4 = function() { ... };
module.exports = new a();
module.exports = new b();
In this file, I’ve function definition.
In the next file, I’m trying to access the methods below
var x = require('./file.js');
x.a.method1(); //Not working
x.method1(); //Not working
But both types of accessing result in error for me. Can you please help me with steps on how to access the methods correctly?
And I can access those functions if I try to have only 1 export in one file. But I want it to be like this. 2 exports in a same file.