When we access or read unknown variable (that are never declared before) in JS, they will display error like following:
    Uncaught ReferenceError: xxx is not defined

    However, undefined value means:
    - Variable that we are using in the code, does not exist
    - No value has been assigned to the variable
    - Property does not exist

    In short, initializing a variable but not assigning a value to the same is called undefined. Example is listed below:

    var x;
    console.log(x); // undefined
    and also
    var x = {name:"demo"};
    console.log( // undefined

    Result will be undefined from above both cases.

    Thus, the correct way to test undefined variable in software testing services is to use 'typeof' operator.
    Ex: if(typeof myVar === 'undefined')

This reply was deleted.
    results->result as $result) { ?>
  1. jobtitle;?>
    company;?>(formattedRelativeTime;?>)city;?>, state;?>
    Welcome to Mobile QA Zone, a Next Generation Software Testing Community.Invite your friends to join this community.Write to us to become a featured member.