Tell us what’s happening:
Hey-- I think that there is a possible bug on the server side for this challenge:
– here is the page:
“https://www.freecodecamp.org/learn/data-visualization/json-apis-and-ajax/get-geolocation-data-to-find-a-users-gps-coordinates”
– here is my code:
<script>
// Add your code below this line
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
$("#data").html("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>
– end of my code.
– my output is this Quote:
" You are here:
latitude: 34.2468096
longitude: -85.15991629999999"
– compiler says this: " // running tests You should display the user’s position within the
data
div element. // tests completed"
– it also says this: Quote:
"SyntaxError: unknown: Support for the experimental syntax ‘jsx’ isn’t currently enabled (3:1):
1 |
2 | // Add your code below this line
3 |
| ^
4 | // Add your code below this line
5 | if (navigator.geolocation) {
6 |
Add @babel/preset-react (https://git.io/JfeDR) to the ‘presets’ section of your Babel config to enable transformation.
If you want to leave it as-is, add @babel/plugin-syntax-jsx (https://git.io/vb4yA) to the ‘plugins’ section to enable parsing."
&& I do not believe that is happening on my side of things.
I believe my code is correct as of now. Can someone help me with this or tell me what to do ??
If there is a pre-set for me to do something with here, I cannot find it.
Would be grateful for any help or reply at all && kind regards, mark-p.
Your code so far
<script>
// Add your code below this line
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
$("#data").html("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/88.0.4324.96 Safari/537.36
.
Challenge: Get Geolocation Data to Find A User’s GPS Coordinates
Link to the challenge: