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

285
Views
¿Por qué la siguiente parte bloquea mi navegador?

Solo quería agregar la siguiente parte a mi código. Cuando hago esto, no obtengo más resultados en la consola y el navegador se bloquea cada vez. Si comento la parte, todo vuelve a funcionar bien. Ya probé todo (ejecuciones de bucle acortadas, conjunto de datos más pequeño, ...) pero nada ayuda. ¿Alguien tiene alguna idea?

 var index_avg_temp_array = []; // array which saves the temperature of each Cluster index_avg_temp_array.push([]); // creates 2d array for (id = 0; id < cluster_points; id++) { // id = index of the cluster var t_array = []; // create array / set array to 'empty' var amount = 0; var check = 0; // takes the id and check if day_array[].index === id for (day = 0; day < days_of_year; day++) { // 365/366 runs, day_array has 1 entry for each day if (day_array[day].index === id) { for (hour = 0; hour < 24; hour++) { // if true - save the hourly temperatures in hour_array var row = day * 24 + hour; var t_temp = hour_array[row].temp; // temperature of each hour t_array.push(t_temp); } check = 1; // if index was found for at least 1 time amount = amount + 1; } } if (check === 1) { // check if the index was found for at least 1 time for (hour = 0; hour < 24; hour++) { var avg = 0; for (counter = 0; counter < t_array.length; counter + 24) { var row = hour * 24 + counter; avg = avg + t_array[row]; // sum up each hour } var avg_hours = avg / amount; // calculate the avg of the hour index_avg_temp_array[id].push(avg_hours); // save the avg temperatures of each hour for each cluster point } } }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

for (counter = 0; counter < t_array.length; counter + 24) {

Esto da como resultado un bucle infinito porque el counter nunca se actualiza. counter + 24 debe ser counter += 24 :

 for (counter = 0; counter < t_array.length; counter += 24) {
about 4 years ago · Juan Pablo Isaza Report
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!