title: Using typeof in JavaScript still causes error for undefined object
body: <p>Hi i'm querying Amazon API and every now and again an item doesn't have an image. I'm trying to account for this but i still get the error: TypeError: Cannot read property '0' of undefined</p>
  
  <pre><code>      if (typeof result.ItemSearchResponse.Items[0].Item[i].SmallImage[0].URL[0] !== undefined) {
            //items['image'][i] = result.ItemSearchResponse.Items[0].Item[i].LargeImage[0].URL[0];
            console.log(result.ItemSearchResponse.Items[0].Item[i].SmallImage[0].URL[0]);
        }
  </code></pre>
  
  <p>If i comment out the if statement the error disappears - is there a better way to use typeof - which would account for the object property not existing at all? Or can anyone give advise on how to solve?</p>
  
  <p>Thanks </p>