Structure JS - Variable empty?
<p>Iam a total JS Newb, and trying to structure my simple JS code a bit. Goal is to get users location. </p>

<p>It works, but the getUserCoordinates function does not return an value? I think it is just a logical failure from a beginner?</p>

<pre><code>var app = {

geocoder: null,

init: function() {
    this.geocoder = new google.maps.Geocoder();
    coordinates = this.getUserCoordinates();
    console.log(coordinates); // empty??
    return;
},

getUserCoordinates: function() {

    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition( 

            function (coords) { 
                console.log(coords); // works Geocoder Object!
                return coords; // the problem 
            }, // more code
</code></pre>
