how do I restart a Javascript function (node.js environment) from inside that has been declared like this:
exports.myfunction = function(parameter){
//myfunction(); does not work
}
how do I restart a Javascript function (node.js environment) from inside that has been declared like this:
exports.myfunction = function(parameter){
//myfunction(); does not work
}
Share
Improve this question
edited Aug 31, 2014 at 15:49
user663031
asked Aug 31, 2014 at 15:08
Igor P.Igor P.
1,4773 gold badges22 silver badges37 bronze badges
2
- 3 Can you clarify what you mean by "restart?" I will assume you mean to recursively call it. Have you tried this.myfunction() or even exports.myfunction() ? – Antiga Commented Aug 31, 2014 at 15:11
- Yes, I was talking about a recursive function call. – Igor P. Commented Sep 1, 2014 at 19:32
2 Answers
Reset to default 6Name it:
exports.myfunction = function myfunction(parameter) {
// ^^^^^^^^^^
myfunction(); // does now work (but leads to a stack overflow obviously)
}
exports.myfunction = function(parameter){
exports.myfunction(); // this works
}