How to check for a null cookie in javascript?
<p>The following switch statement is not catching a cookie that does not exist.</p>

<pre><code>switch (stateCookie) {
                    case 'Virginia':
                        window.location = '/Teacher-Login/VA';
                        break;
                    case 'North Carolina':
                        window.location = '/Teacher-Login/NC';
                        break;
                    case 'South Carolina':
                        window.location = '/Teacher-Login/SC';
                        break;
                    case null:
                        window.location = '/Teacher-Login/VA';
                        break;
                    case '':
                        window.location = '/Teacher-Login/VA';
                    default:
                        window.location = '/pages/state-login/login.html';
</code></pre>

<p>Ok, I have tried several things but I am still inexplicably having trouble with this. Here is the code that I have at this moment:</p>

<pre><code>$('#welcome select').change(function () {
    var stateSelected = $('option:selected', this).val();
    var stateCookie = getCookie("ia_state");
    if(stateSelected != stateCookie)
    {
        setCookie('ia_state', stateSelected);
        switch (stateCookie) {
            case 'Virginia':
            case null:
            case '':
                window.location = '/Teacher-Login/VA';
                break;
            case 'North Carolina':
                window.location = '/Teacher-Login/NC';
                break;
            case 'South Carolina':
                window.location = '/Teacher-Login/SC';
                break;
            default:
                window.location = '/pages/state-login/login.html';
}
}
}); 
</code></pre>

<p>The switch statement is being evaluated but it is always going to the default case. I have yet to figure out how to catch it if the cookie is null/undefined.</p>
