What is the cause of "Cannot read property 'hasOwnProperty' of undefined" in this code snippet?
<p>I've seen the error in the title come through in our logs several times. It's being thrown from the last line in the code snippet below. From my research, this error is thrown when attempting to access a variable that doesn't exist; however, I'm under the impression that I'm checking for that very existence on line 1. </p>

<pre><code>if(rental_application.rental_history &amp;&amp; rental_application.rental_history.length &gt; 0) {
    candidate.rental_history = [];
        _.each(rental_application.rental_history, function(rental) {
</code></pre>

<p>What could be the issue here?</p>