I am trying to geocode an array of postcodes from a json file using gmaps.js.
There are 101 postcodes in the array however when I loop through them to use with gmaps.js it only iterates through 11. I have tried looking around for answers, however i can't figure it out, everything looks correct, here is my code
var getPostcodes = function () {
                    var json = "http://example.co.uk/addresses.json";
                    var request = new XMLHttpRequest();
                    request.open('GET', json, true);
                    request.onload = function () {
                        if (request.status >= 200 && request.status < 400) {
                            // Success!
                            var data = JSON.parse(request.responseText);
                            //GET POSTCODES IN ARRAY
                            var postcodesArray = [];
                            for (var i = 0; i < data.length; i++) {
                                postcodesArray.push(data[i].from_postcode);
                            }
                            var postcodes = postcodesArray.filter(Boolean);
                            //GET LAT/LONG POSITIONS
                            for (var n = 0; n < postcodes.length; n++) {
                                GMaps.geocode({
                                    address: postcodes[n],
                                    callback: function (results, status) {
                                        if (status == 'OK') {
                                            var location = results[0].geometry.location;
                                            var latitude = parseFloat(location.lat().toFixed(8)),
                                                longitude = parseFloat(location.lng().toFixed(8));
                                            console.log(latitude + ' ' + longitude);
                                        }
                                    }
                                });
                            }
                        }
                        else {
                            console.log("failed");
                        }
                    };
                    request.send();
                }
                getPostcodes();
//EDIT console log
//EDIT codepen link
