Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

154
Vistas
how to combine 2 object in json array and give comma?

hi i need help to write a format code. i write javascript code to parse json and use the data, the json file contain latitude and longtitude data :

const api_url = 'json.php'
async function getjsonlatest() {
    const response = await fetch(api_url);
    const data = await response.json();

i can grab data from array [0]

const api_url = 'json.php'
async function getjsonlatest() {
    const response = await fetch(api_url);
    const data = await response.json();
    const latitude = (data[0].latitude)
    const longitude = (data[0].longtitude)
    console.log(latitude)
    console.log(longitude)
           

the console.log result is (line 1) -7.247100 (line 2) 112.775340

i need to format like this [latitude,longitude] to fill this code :

marker.setLatLng([latitude, longtitude]);

how can achieve that?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You dont need to worry about the comma.

marker.setLatLng([latitude, longtitude]);

this code is already functional and will call setLatLng() with an array arg containing latitude and longitude

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda