How do you debug a syntax error?

How do you debug a syntax error?

I keep getting a syntax error on line 3 and 4 of this very simple script. Normally firebug would give me enough info to fix this but jQuery escapes me. I can see no reason for the errors. Is it the library or something is missing
?

  1.     <script type="text/javascript">   
        $(".shipping-switch[name=\'shipping_switch\']").click(function()
        {
              var selector = "div#sub-address";
              if($(this).val() === "1")
              {
                $(selector).slideDown("fast");
              }
              else
              {
                $(selector).slideUp("fast");
              }
        });
        </script>