I am facing some stupid issue for which I know I am missing something.
I have a blank array in which I am pushing stuff using .push() method.
Now When I print complete array, I get values, but when I use array.length then it is always zero. I know it is very silly something that I am missing.
var markersToPush = [];
for (var i = 0; i < contactList.length; i++) {
    console.log('conatcat addres', contactList[i].MailingStreet);
    geocoder.geocode({
        'address': contactList[i].MailingStreet
    }, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
            map.setCenter(results[0].geometry.location);
            var marker = new google.maps.Marker({
                map: map,
                position: results[0].geometry.location
            });
            markersToPush.push(marker.getPosition());
        } else {
            alert("Geocode was not successful for the following reason: " + status);
        }
    });
}
console.log('markers to push-->', markersToPush);
console.log('markers length-->', markersToPush.length);
For result in log -
I have already checked other linked issues -

 
     
    