Declare a new variable that shows whether the geocoding has been called, and change it to true the first time this happens.
var geoCalled = false;
var geocoder = new google.maps.Geocoder();
geocoder.geocode({ 'address': 'Stockholm' }, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var latitude = results[0].geometry.location.nb;
var longitude = results[0].geometry.location.ob;
if (!geoCalled) {
console.log(latitude);
geoCalled = true;
}
}
});