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).
1 comment
Comment actions Permalink

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

0

Please sign in to leave a comment.