Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

385
Views
¿Por qué agregar una declaración else ralentiza tanto mi código?

Siento que tal vez haya una respuesta obvia. Cuando estoy ejecutando este código:

 function searchQuery() { var compiledParticipantsSheet = spreadSheet.getSheetByName('Participants'); var participantsSheetLr = compiledParticipantsSheet.getLastRow(); var participantsSheetLc = compiledParticipantsSheet.getLastColumn(); var querySheet = spreadSheet.getSheetByName('Query'); var querySheetLr = querySheet.getLastRow(); var querySheetLc = querySheet.getLastColumn(); var data = querySheet.getRange(3, 1, querySheetLr, querySheetLc).getValues(); for (j = 2; j <= participantsSheetLr; ++j) { var val = compiledParticipantsSheet.getRange(j, 2, 1, 1).getValue(); console.log('Searching Query sheet for row ' + j + ' -- ' + val) for (i = 0; i < data.length; ++i) { if (data[i][4] == val) { var foundData = (data[i][20]); console.log('------ Found email in query row ' + (i + 3) + ' = ' + foundData); compiledParticipantsSheet.getRange(j, 11, 1, 1).setValue(foundData); }else{ compiledParticipantsSheet.getRange(j, 11, 1, 1).setValue('Participant not found'); } } } }

Funciona terriblemente lento, pero si elimino la declaración one else al final, ¡funciona súper rápido! ¿Es eso razonable? ¿Me estoy perdiendo de algo? ¡Gracias!

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!