I need to put a function in a javascript object, how do I add a JSDoc comment in this case?
/**
* @typedef {Object} testObj
* @property {!String} testName - testName
* @property {?Function} [testFunction=null] - testFunction
*
*/
var testObj = {
testName:null,
testFunction:null
}
In this form, null is the default value for the function, so it is expressed like this.
I just want to ask if it is enough to write only the @property {?Function}
and write the parameter in the Object part, or if there is another way.
In the testFunction above, I want to show in JSDoc that a function with parameters {Number} a, {number} b, {Object} c
is put in. If there is a way, I would appreciate it if you let me know.
And I also want to express that this function returns a String
.