JS validation. Follow
Hi. While editing JavaScript my function gets objecte as param:
function validate(obj) {
var codesValid = obj.codesValid === undefined ? false : obj.codesValid;
//..
}
The code validation automatically underlines the 'obj.codesValid' -- as 'Unresolverd variable codesValid'.
What are the hints to validate this? The obj is object received from server by AJAX (JSON).
}
The code validation automatically underlines the 'obj.codesValid' -- as 'Unresolverd variable codesValid'.
What are the hints to validate this? The obj is object received from server by AJAX (JSON).
Please sign in to leave a comment.
Hi Alex,
If you are using latest EAP, you can annotate your function with @param tag, i.e.:
/** @param {{codesValid:boolean}} obj */
function validate(obj) {
var codesValid = obj.codesValid === undefined ? false : obj.codesValid;
}
Regards,
Konstantin