简体   繁体   中英

How can I call an exported function from itself?

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
}

Name 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
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM