Tell us what’s happening:
Hey all, I wasn’t sure how to get this to whoever might want to see it, so I thought I’d post here. The test on this particular exercise seems to be checking for explicit words rather than for functioning code: I had initially truncated the example’s position
parameter to pos
, but my test threw an error that my code should read position.coords.latitude
etc. I then changed only that part of the code, and my tests passed, despite the fact that, because the parameter I passed was pos
, the position
reference wasn’t defined. That seemed like an oversight to me, and wasn’t sure if that was something anyone would want to address.
Also, if there’s a better avenue for this sort of comment, feel free to let me know and I can redirect it. Thanks!
**Your code so far**
<script>
// Add your code below this line
if (navigator.geolocation){
navigator.geolocation.getCurrentPosition(pos => {
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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.88 Safari/537.36
Challenge: Get Geolocation Data to Find A User’s GPS Coordinates
Link to the challenge: