title: Javascript - catching error if json key does not exist
body: <p>I'm trying catch the error for when a certain key doesn't exist in json from an API, in this case imageLinks.thumbnail.</p>
  
  <p>This is what I wrote so far but I still get TypeError: Cannot read property 'thumbnail' of undefined.</p>
  
  <pre><code>            let cover;
              if(results.imageLinks === undefined){
  
                  let cover = "http://actar.com/wp-content/uploads/2015/12/nocover.jpg";
  
              } else {
                  let cover = results.imageLinks.thumbnail;
              };
  </code></pre>
  
  <p>Help would be much appreciated.</p>
  
  <p>Cheers</p>