**Purpose: Find undefined variables**

Suppose we have a set of variables: varA, varB, varC

we know the following expression is valid:

```
varA + varB - varC

```

and the following expression is not valid(because VARC is not in the set of variables):

```
varA + varB - VARC

```

I've made it working by:

```
function validate(comma separated variables)
{
    the literal expression
    return 'PASS'
}

```

Now I simply run "validate()" **without passing in any argument**(Yes, it is supported by javascript), if the function returns 'PASS', it means the literal expression is valid. Otherwise it has error.

In this example, the function will not return 'PASS' because we have a typo in "varA + varB - VARC" and "VARC" will be reported by the javascript debugger.

```
function validate(varA, varB, varC)
{
    varA + varB - VARC
    return 'PASS'
}
validate();  //call the function WITHOUT passing in any argument

```

---------------------All good so far. I can validate arbitrary expression ! ---------------------

However, if I use javascript objects as a variable in the set, this way does not work. In the following code, 'PASS' is returned (while I'm expecting the debugger report error).

```
function MyClass()
{
    this.attr1 = null
    this.attr2 = null
}

myClass = new MyClass();

function validate(varA, varB, varC)
{
    varA + varB - varC + myClass.attr3
    return 'PASS'
}

```

Question 1: How do I find a way to report "myClass.attr3" is not defined? 

NOTE: I can not tokenize (actually it is more complicated, has to be a grammar parser) the EXPRESSION and validate each token via "undefine test". I have to validate at the EXPRESSION level.

Edit:

I've tested the code and found that:

```
varA === undefined
VARC can not be evaluated, exception thrown  //the only case that is helping me
myClass.attr1 === null
myClass.attr3 === undefined

```