Mr.KGK Mr.KGK - 1 year ago 72
Javascript Question

For Each loop ---> For loop Urgent Need

I am having a error that states that data.forEach is not a function. The code is:

The code that I edited:

The error with console.log(data)

Answer Source

data is an object. It looks like you want to loop over the features array within that object, so do:

data.features.forEach(function(element, index) {
    isoGeojson.features[index] = {
        type: 'Feature',
        geometry: {
            type: 'MultiPolygon',
            coordinates: element.coordinates.slice()
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download