title: .getFeatures() method for ol.source.Vector instance working in console, but not in script
body: <p>I'm trying to return the attributes of a vector source in OpenLayers (v.4) using the .getFeatures function some indexing, and the .get('key') method, like so: <code>gdeltVectorSource.getFeatures()[15].get('count')</code>.  When I enter this into the developer console in Chrome, the result is as expected and it works just fine.  However, when added to the script referenced in the html document, it returns: <code>Uncaught TypeError: Cannot read property 'get' of undefined at pen.js:46</code>.  It seems to fail to return an array of features from .getFeatures().  Can someone help me understand why this occurs?  I'd like to return attributes of a vector source in order to use the values ('count' in this example) in styling, etc.  Is there something about how javascript compiles and runs code that I'm missing?</p>
  
  <p>Here's <a href="https://codepen.io/toddjacobus/pen/MXVeVy?editors=1111" rel="nofollow noreferrer">a link to a codepen</a> that illustrates what I'm talking about. The points don't display (I don't know why, but it's irrelevant), but the source loads just fine.  Also note, you'll have to open the chrome console to see error message.</p>
  
  <p>Thank you for stopping to read my question!</p>