Let's say I have a simple class like this in fileA.js
:
class foo {
constructor(x) {
this.name = x
}
fooMethod(x) {
return x + 'hello';
}
}
And I want to import and use fooMethod
in fileB.js
like this:
import { fooMethod } from './fileA';
class bar() {
...
barMethod(x) {
return fooMethod(x);
}
}
How would I write the export
in fileA
to achieve this?