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

197
Vistas
Use la posición de las matrices como parámetros de función

Estoy tratando de pasar posiciones de una lista de matrices en una función, pero definitivamente me estoy perdiendo algo.

Este es mi guión:

 // function to display the results function display(array){ var source = SpreadsheetApp.openById("x"); var sheet = source.getSheetByName('x') var value = sheet.getRange("G4:I4").setValue(array[x][y]) //sets the range to the value } // function that creates or searches for the array function recherche() { var source = SpreadsheetApp.openById("x"); var sheet = source.getSheetByName('x') var arrays = [ [1,2,3,4,5], [6,7,8,9,10] ] display(arrays[0][0]) // first time it is executed it should display arrays[0][0] or 1 return arrays } // function to display the next value function next(){ var source = SpreadsheetApp.openById("x"); var sheet = source.getSheetByName('x') display(recherche()[x+1][0]) // should display arrays[1][0] or 6 }

¿Estoy haciendo algo estúpido o simplemente me perdí algo?

Gracias

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

Hay tantas maneras de hacer esto:

Primero:

 function myTest() { let i = 0; let arrays = rechershe(); // will display arrays[0][0] i++; next(arrays,i); } function next(arrays,i) { display(arrays[i][0]); }

O:

 function myTest() { let i = 0; let arrays = rechershe(); // will display arrays[0][0] i++; next(arrays[i][0]); } function next(value) { display(value); }

O:

 function myTest() { let i = 0; let arrays = recherche(); // will display arrays[0][0] i++; function next() { display(arrays[i][0]); } next(); // will display arrays[1][0] }

Y todavía otro:

 function myTest() { let i = 0; let arrays = recherche(); i++; next = () => display(arrays[0][i]); next(); i++; next(); } 8:15:58 AM Notice Execution started 8:16:00 AM Info 1 8:16:00 AM Info 2 8:16:00 AM Info 3 8:15:59 AM Notice Execution completed
about 4 years ago · Santiago Gelvez 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