how does if condition evaluates its value in javascript
===

How does javascript if condition determines its value?, see this example:

    <script type="text/javascript">
    
        var bar = ("something" == true);
        alert(bar); // 1
    
        if ("something") {
            alert("hey!"); // 2
        }
    
    </script>

Why do I get to point //2 while 'bar' at //1 is false?

As I can see `bar` value gets calculated in almost the same way the if condition, or it doesn't?