title: How to convert lat long from decimal degrees to DMS format?
body: <p>Assuming I have a latitude longitude: 38.898556, -77.037852. How do I convert this to DMS?</p>
  
  <p>Expected output is:
         </p>
  
  <pre><code>38 53 55 N
  77 2 16 W
  </code></pre>
  
  <p>Want to be able to accept both a latitude and longitude as input parameters in the function.</p>
  
  <p>Current function is as follows:</p>
  
  <pre><code>function convertDMS( lat, lng ) {
  
          var convertLat = Math.abs(lat);
          var LatDeg = Math.floor(convertLat);
          var LatMin = (Math.floor((convertLat - LatDeg) * 60));
          var LatCardinal = ((lat &gt; 0) ? "n" : "s");
  
          var convertLng = Math.abs(lng);
          var LngDeg = Math.floor(convertLng);
          var LngMin = (Math.floor((convertLng - LngDeg) * 60));
          var LngCardinal = ((lng &gt; 0) ? "e" : "w");
  
          return LatDeg + LatCardinal + LatMin  + "    " + LngDeg + LngCardinal + LngMin;
  }
  </code></pre>