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

223
Vistas
Can someone explain how this parameter is able to get a value?
getWeatherData();
function getWeatherData(){
        navigator.geolocation.getCurrentPosition((success) => {
            console.log(success)
        })
    }

It returns an object with lat, long and other info, but how? Success is literally a parameter and has no value, right? It's not defined anywhere and I didn't pass a value in when I invoked the function.

Can someone explain to me how this works?

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

0

Function parameters get values when the function is called.

You are passing a function (lets call it anon) as an argument to getCurrentPosition.

getCurrentPosition (which you did not write and which you are not looking at the source code of) or a function that it passes anon onto will, at some point, call it. At that point anon is passed arguments.

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