As you can see the following, the geolocation.get current location has a function to be an argument, and the usage of the function is to return position and show the position, so what is the usage of getCurrentLocation while the function finished the job? I hope I’ve made me clear, I’m confused about this, anybody can help me with this?
**Your code so far**
<script>
// Add your code below this line
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
document.getElementById('data').innerHTML = "latitude: " + position.coords.latitude + "<br>longitude: " + position.coords.longitude;
});
}
// Add your code above this line
</script>
<h4>You are here:</h4>
<div id="data">
</div>
**Your browser information:**
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36
Challenge: Get Geolocation Data to Find A User’s GPS Coordinates
Link to the challenge: