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

285
Vistas
What do square brackets after function call mean?

I'm trying to understand the purpose of the [0] in the function call I came across and what value is returned to x?

x = my_function(var1, var2)[0];

function my_function(v1, v2){
  var v3, v4

  v3 = v1 * 3;
  v4 = v2 * 7;

  return( [v3, v4] );
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

They mean that the function returns an array and you only need the first element of that array.

return is not a function, by the way. You don't need the parenthesis.

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