Recover Value Array

Asked

Viewed 63 times

3

I have an array of strings. I’m trying to recover the value of Allotment, but I’m not getting it. Take a look at the code:

 var cord = ["-19.45738,-44.2416695"];
  
  for(var i = 0; i<cord.length; i++){
        var location = cord[i].split[","];
        var marker = new google.maps.Marker({
        position: new google.maps.LatLng(location[0], location[1]),
        map: map
    });
         
       
    }

  • Are you sure you need to go?

1 answer

7

What’s wrong is the split:

var location = cord[i].split(",");

split is a function, parentheses are used.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.