Looping and finding empty array
<p>I'm working on project in which I have to create a search engine through jQuery. Everything has been going great until I started looping through the array.</p>

<p>I don't know whether I'm doing it wrong, but for some reason, when I use a conditional it does not output the statement I want it to say. If I change the conditional to say whether there's something in the array output this, it does. But if the array is empty it does absolutely nothing. Why is that?</p>

<pre class="lang-js prettyprint-override"><code>for(var i = 0, j = response.length; i &lt; j; i++){ 
    var searchItemRes = response[i];
    if(response.length === 0){
        $('' + '&lt;ul&gt;' +
            '&lt;li&gt;&lt;span&gt;Nothing found, try again&lt;/span&gt;&lt;/li&gt;' +
            '&lt;/ul&gt;'
        ).appendTo(searchResults);
    }
    $('' + '&lt;ul&gt;' +
        '&lt;li&gt;&lt;img src="" /&gt;&lt;span&gt; '+searchItemRes.title+'&lt;/span&gt;&lt;/li&gt;' +
        '&lt;/ul&gt;'
    ).appendTo(searchResults);
}
</code></pre>
