title: How to use Mapbox Geocoding API in JavaScript to reverse geocode a point?
body: <p>I have read a lot of SO questions and answers and looked at <a href="https://docs.mapbox.com/api/search/#reverse-geocoding" rel="nofollow noreferrer">the Mapbox documentation</a> but I can't see a simple example of how to reverse geocode from a latitude/longitude point. <a href="https://docs.mapbox.com/api/search/#example-request-reverse-geocoding" rel="nofollow noreferrer">The example</a> only shows the URL to use to make a query but presumably there's a way to do it using the <code>MapboxGeocoder</code> object? </p>
  
  <p>So, here, what would I use to display the reverse geocode for lat/long when the user clicks on the map?</p>
  
  <pre class="lang-js prettyprint-override"><code>var map = new mapboxgl.Map({
    container: document.getElementsByClassName("js-map")[0],
    center: [0, 51],
    style: "mapbox://styles/mapbox/streets-v11",
    zoom: 11
  });
  
  map.on("click", function(ev) {
    // 1. Reverse geocode `ev.lngLat.lat` and `ev.lngLat.lng`
    // 2. Do something with the result.
  });
  </code></pre>