JS validation.
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).
请先登录再写评论。
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