How to enter coordinates in a javascript array

0

I am working on a small project to mark positions in Google Maps, I do not know how to read a file .txt that contains the coordinates of the markers by longitude and latitude, as an example:

-15.432545, 6.4344523 \n
-15.563452, 6.5423455 \n
...

In each line there is the longitude and the latitude separated by commas, then there is a line jump to continue to another position. Does anyone know how to enter this data in an array in javascript? Here I attach the code of how the marker is entered

function initMap() {
    var Bello = {
        lat: 6.34803789449,
        lng: -75.5709292724
    };
    var map = new google.maps.Map(document.getElementById('map'), {
        zoom: 13,
        center: Bello
    });
    var marker = new google.maps.Marker({
        position: Bello,
        map: map
    });
}
    
asked by Kevin Gutierrez 12.05.2018 в 03:53
source

0 answers