How can I achieve that in Javascript?
exports.functions = {
my_func: function (a) {
my_func(a);
}
}
A function expression can have an optional name after the function keyword. The scope of this name is just the function body, and allows it to be called recursively:
exports.function = {
my_func: function this_func(a) {
this_func(a);
}
}
You can also use its full name:
exports.function = {
my_func: function(a) {
exports.function.my_func(a);
}
}
functions.