This is my solution for this.
I'm not describing a return in the first function and also document the inner function, which results in getting the documentation from the inner function.
/**
* Function to create a Function with multiple prompt messages
* @function
* @param {Number} count - number of times to prompt
*/
function many_prompts(count) {
/**
* To prompt a value multiple times
* @function
* @param {String} prompt - parameter to prompt
* @return {void} prompt the input parameter
*/
return function(prompt) {
for(var i=0; i < count; i++) alert(prompt);
}
}
//Example of use:
var y = many_prompts(3);
y('Hello World');
Which is then shown e.g. in vscode like this...
For the outer function:
For the inner function:
You can also add an additional description when assigning the function, to describe the difference
/**
* Function to prompt a value 3 times
* @function
* @param {Number} prompt - parameter to prompt
* @return {void} prompt the input parameter
*/
const y = many_prompts(3);
y('Hello World');