Hej, i don't understandt, why, this dosent work, i am trying to make an factory to add locations to my map, but i am new to the google maps API, and not thatb adv. in JavaScript. i know that if it had bin an c# function it will work. hope sombody can help, and sorry for my pure spelling skills,
function calcLatLng(adresse) { var Local = new google.maps.LatLng; geocoder.geocode({ 'address': adresse }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { Local = results[0].geometry.location; console.log(Local); //this log the corect result, } else { } });// if i make an 'console.log' here only gets a empty 'google.maps.LatLng' object return Local;}function addNewPlace(info, icon, adresse, title) { var marker = new google.maps.Marker({ map: map, position: calcLatLng(adresse), // but here i only gets a 'undefind' title: title, icon: icon }); var infowindow = new google.maps.InfoWindow({ content: info }); infowindow.open(map, marker);}