So I want to create a function as follows:
Using various amount of arguments
/** * Stuff with one argument. * @method foo * @param {type} a One argument. */ /** * Stuff with more arguments. * @method foo * @param {type} a1 Argument one. * @param {type} a2 Argument two enz. */ function foo() { if (arguments.length > 1) { // Awesome code thats doing stuff with more arguments } else { // Awesome code thats doing stuff with one argument } }
Using different types of arguments
/** * Stuff with string argument. * @method doo * @param {string} s String argument. */ /** * Stuff with number argument. * @method doo * @param {number} n Number argument. */ function doo() { if (typeof arguments[0] == "string") { // Awesome code thats doing stuff with string } else if (typeof arguments[0] == "number") { // Awesome code thats doing stuff with number } }
Now in my lovely VSCode will show this:
How can I accomplish that I can step through the different documentation comments?