I
I
Igor Dominator2014-03-29 19:54:30
JavaScript
Igor Dominator, 2014-03-29 19:54:30

How to remove parentheses from the result of a function?

Good evening.
We have a fragment of a function that determines the latitude and longitude on google maps

function initialize() {
  var mapOptions = {
    center: new google.maps.LatLng(49.053676508106875,33.423500061035156), 
    zoom: 12, 
    mapTypeId: google.maps.MapTypeId.ROADMAP
   };
  var map = new google.maps.Map(document.getElementById("map_canvas"),
  mapOptions);
  
  
  google.maps.event.addListener(map, "click", function(event)	{
  GetLocalWeather();
  if (markersArray) {
    for (i in markersArray) {
      markersArray[i].setMap(null);
    }
  }
  
  placeMarker(event.latLng);	
  var query= event.latLng;

The value of the query variable looks like this (49.053676508106875,33.423500061035156).
How to remove brackets so that 49.053676508106875,33.423500061035156 (without brackets) gets into the query?
Thanks in advance to all kind people

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2014-03-29
@SNPAC

If you look at the Google Maps Javascript API , then the most correct thing would be
var query = event.latLng.toUrlValue(15);

M
maxaon, 2014-03-29
@maxaon

"(49.053676508106875,33.423500061035156)".slice(1,-1) //best
"(49.053676508106875,33.423500061035156)".replace('(','').replace(')','')
"(49.053676508106875,33.423500061035156)".replace(/\(|\)/g,'')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question