I want to display on screen the var longitude en latitude but I think that the function is executing last and I'am stuck with the initial values.
The objective is to print on screen the exact values of the geolocation that the browser returns.
Thanks !!!

```
<!DOCTYPE html>

<head>

<script>
var longitude = "10";
var latitude = "20";
</script>

</head>
<html>
<body  onload="getLocation()">

<script>
var longitude = "30";
function getLocation() {

    if (navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(function(position){
                latitude = position.coords.latitude;
                longitude = position.coords.longitude;
                alert('aaab:' +longitude);
    });
    }else {
                   alert("Geolocation API is not supported in your browser.");
    }
    }

</script>

<script>
alert("ccc");
document.write (longitude);
document.write (latitude);

</script>
</body>
</html>

```

i know that it's working within the function, but there is any way to use those variable outside? I just want to be able to store them in one global variable that cand be called wherever. Thanks