title: Convert what looks like a number but isn't to an integer (Google Earth Engine)
body: <p>I'm trying to get the number of images in an image collection in the Google Earth Engine (GEE) code editor. The image collection <code>filteredCollection</code> contains all Landsat 8 images on GEE that cover Greenwich (just an example).</p>
  
  <p>The number of images is printed as 113 but it doesn't appear to be of type integer and I can't coerce it to an integer either. Here's what that looks like:</p>
  
  <pre><code>var imageCollection = ee.ImageCollection("LANDSAT/LC8_SR");
  var point = ee.Geometry.Point([0.0, 51.48]);
  var filteredCollection = imageCollection.filterBounds(point);
  
  var number_of_images = filteredCollection.size();
  print(number_of_images); // prints 113
  print(number_of_images &gt; 1); // prints false
  print(+number_of_images); // prints NaN
  print(parseInt(number_of_images, 10)); // prints NaN
  print(Number(number_of_images)); // prints NaN
  print(typeof number_of_images); // prints object
  print(number_of_images.constructor); // prints &lt;Function&gt;
  print(number_of_images.constructor.name); // prints Ik
  
  var number_of_images_2 = filteredCollection.length;
  print(number_of_images_2); // prints undefined
  </code></pre>
  
  <p>Any idea what's happening here and how I can get the number of images in the collection as an integer?</p>
  
  <p>P.S.: Collection.size() is the recommended function for getting the number of images in the <a href="https://developers.google.com/earth-engine/ic_info" rel="nofollow noreferrer" title="GEE developer&#39;s guide">GEE docs</a>.</p>