title: String comparison in javascript fails
body: <p>Hi i have a problem when comparing two strings. the problem is that when i compare the equality of <code>status</code> variable with <code>"success"</code> string literal it returns <code>False</code>, However when I check the value of the <code>success</code> via <code>alert</code> or <code>console.log</code> I get <code>"success"</code>.</p>
  
  <p>when I use <code>status.valueOf() == "success"</code> I get an error which says <code>Can not call method 'valueOf' of undefined</code> but when checking </p>
  
  <pre><code>// this is a callback function used in jQuery.post(url, data, callback)
  this.callback = function(data, status, jqXHR) { 
      alert(status); // shows that status is equal to "success"
      console.log("STATUS: " + status);
  console.log("STATUS CONSTRUCTOR: " + status.constructor);
  console.log("STATUS TYPE: " + (typeof status));
      if(status.valueOf() === "success") {
          var data = JSON.parse(data);
          if(data.errors) {
              this.success(data.message);
          } else {
              this.failure(data.message, data.errors);
          }
      } else {
          alert("WTF");
      }
  };
  </code></pre>
  
  <p><strong>UPDATE 2:</strong></p>
  
  <p>This is what i get after logging some attributes of the <code>status</code>:</p>
  
  <pre><code>&gt;&gt;&gt;console.log("STATUS: " + status);
  STATUS: success add_poll.js:34
  &gt;&gt;&gt;console.log("STATUS CONSTRUCTOR: " + status.constructor);
  STATUS CONSTRUCTOR: function String() { [native code] } add_poll.js:35
  &gt;&gt;&gt;console.log("STATUS TYPE: " + (typeof status));
  STATUS TYPE: string add_poll.js:36
  STATUS: undefined add_poll.js:34
  Uncaught TypeError: Cannot read property 'constructor' of undefined add_poll.js:35
  (callback add_poll.js:35)
  (callback add_poll.js:41)
  (fire jquery.js:1037)
  </code></pre>