Undefined test not working in javascript
<p>I'm getting the error <code>'foo' is undefined.</code> in my script when i test my function with an undefined parameter. As far as I understand, This shouldn't be happening.</p>

<p>My calling code:</p>

<pre><code>//var foo
var test = peachUI().stringIsNullOrEmpty(foo) ;
</code></pre>

<p>My function (part of a larger framework).</p>

<pre><code>    stringIsNullOrEmpty: function (testString) {
        /// &lt;summary&gt;
        ///     Checks to see if a given string is null or empty.
        /// &lt;/summary&gt;
        /// &lt;param name="testString" type="String"&gt;
        ///     The string check against.
        /// &lt;/param&gt;
        /// &lt;returns type="Boolean" /&gt;

        var $empty = true;

        if (typeof testString !== "undefined") {
            if (testString &amp;&amp; typeof testString === "string") {

                if (testString.length &gt; 0) {
                    $empty = false;
                }

            }
        }
        return $empty;
    }
</code></pre>

<p>Any ideas?</p>

<p>Please note. I've had a good read of other similar questions before posting this one.</p>
