Answer the question
In order to leave comments, you need to log in
How to call a method from another class in JS?
Good day. Faced one problem (not so selenium in JS) - I created 2 classes in two different files. In one of them, you need to call a method of another class. But no matter how I called (as I expected) - I can not call. He writes, they say:
(node:1240) UnhandledPromiseRejectionWarning: ReferenceError: ParserFile is not defined
const ParseFile = require("./ParseFile");
class CLI {
constructor() {
(async () => {
// Что то делает
if (response.fileNew) {
ParserFile.parseFile(response.fileNew);
}
if (response.fileOld) {
ParserFile.parseFile(response.fileOld);
}
})();
}
}
const cli = new CLI();
export class ParserFile {
parseFile(file) {
// Что то выполняет
}
}
const parserfile = new ParserFile();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question