title: toRad() Javascript function throwing error
body: <p>I'm trying to find the distance between two points (for which I've latitudes &amp; longitudes) using the technique described here at <a href="https://stackoverflow.com/questions/27928/how-do-i-calculate-distance-between-two-latitude-longitude-points">Calculate distance between two latitude-longitude points? (Haversine formula)</a></p>
  
  <p>The codes are as below 
  Javascript:</p>
  
  <pre><code>var R = 6371; // Radius of the earth in km
  var dLat = (lat2-lat1).toRad();  // Javascript functions in radians
  var dLon = (lon2-lon1).toRad(); 
  var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
          Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) * 
          Math.sin(dLon/2) * Math.sin(dLon/2); 
  var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 
  var d = R * c; // Distance in km
  </code></pre>
  
  <p>But when I try to implement it, an error shows up saying <code>Uncaught TypeError: Object 20 has no Method 'toRad'</code>.</p>
  
  <p>Do I need a special library or something to get .toRad() working? because it seems to be
  screwing up on the second line.</p>