Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

155
Visualizações
Map.getCenter() is returning functions instead of coordinates

When I try to run map.getCenter it gives me the following output in console.

_.Re {lat: ƒ, lng: ƒ}
lat: ƒ ()
arguments: null
caller: null
length: 0
name: ""
prototype: {constructor: ƒ}
[[FunctionLocation]]: js?key=AIzaSyDBLdIb7…s_8&sensor=false:77
[[Prototype]]: ƒ ()
[[Scopes]]: Scopes[3]
0: Closure (_.Re) {d: 32.80198280861661, e: -97.26947303917295}
1: Closure {_: {…}, baa: ƒ, daa: ƒ, qa: ƒ, ta: ƒ, …}
2: Global {0: Window, window: Window, self: Window, document: document, name: '', location: Location, …}
lng: ƒ ()
arguments: null
caller: null
length: 0
name: ""
prototype: {constructor: ƒ}
[[FunctionLocation]]: js?key=AIzaSyDBLdIb7…s_8&sensor=false:77
[[Prototype]]: ƒ ()
[[Scopes]]: Scopes[3]
[[Prototype]]: Object

This is how I used it in my code and called the map.getCenter by try and catch

   xhr.onload = function(){
      if(this.status == 200){
         const users = JSON.parse(this.responseText);
         console.log(users.businesses);
         length = users.businesses.length
         let lat = 32.75
         let lng = -97.13
         // if (lat!= 32.75 || lng!=-97.13)
         try {
            console.log(map.getCenter())

         } catch (error) {
            console.log(error)
         }
         
         initMap(length,users,lat,lng)
         
         


         
      }
   }

Afaik It's supposed to just return coordinates in places of latitude and longitude.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It was my bad. I tried to access it by Map.getCenter().lat but it should have been Map.getCenter().lat()

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda