Why does P != "P" in my JSON response? : <p><strong>QUESTION:</strong></p>

<p>For some strange reason, it seems "P" from my JSON is not equal to "P" but "P"=="P" returns true. This makes no sense.</p>

<p>There must be some data type issue somewhere.</p>

<p>How can I make sure <code>response.charAt(0) == "P"</code> returns <code>true</code> ?</p>

<hr>

<p><strong>CODE:</strong></p>

<pre><code>$.ajax({
        type: "POST",
        url: "/1/1",
        data: someData,
    }).done(function(response) {
        console.log("p" == "P"); //prints false
        console.log("P" == "P"); //prints true
        console.log("RESPONSE: "+response); //prints "Primary"
        console.log("RESPONSE FIRST LETTER: "+response.charAt(0)); //prints P 
        console.log("RESPONSE BOOL P :"+response.charAt(0)=="P"); 
        //
        //false for some reason, should be true 
        //
        if (response.charAt[0] == "P") {
            console.log("1");
            localStorage.setItem("error_msg_local", message);
        } else if (response.charAt[0] == "L") {
            localStorage.setItem("success_msg_local", message);
            console.log("2");
        } else {
            localStorage.setItem("error_msg_local", "Internal error. Please try again.");
            console.log("3");
            // 3 gets logged when it should have been 1
        }
    });
</code></pre>
