Answer the question
In order to leave comments, you need to log in
How to call a function in an object?
How to call a function in this way?
module.exports = {
func1: ()=>{...},
func2: ()=>{
...
func1() // Как правильно вызывать эту функцию?
...
}
}
Answer the question
In order to leave comments, you need to log in
Option 1: save the object, then throw it into exports
const object = {
func1: ()=>{...},
func2: ()=>{
...
object.func1();
...
}
};
module.exports = object;
module.exports = {
func1() {...},
func2() {
...
this.func1();
...
}
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question