I have a class in a JavaScript file
class engine
{
constructor(a)
{
this._a = a;
}
foo = function()
{
console.log(this._a);
}
}
module.exports.engine = engine;
Then in my NodeJS file I do
const engine = require('./engine.js');
Now my question is, how can I call foo()
from my class in the NodeJS file with using the constructor new engine('bar')
?