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

142
Views
¿Combinar múltiples salidas de múltiples funciones en una matriz en Javascript?

Ejemplo

Tengo estos valores, ¿hay alguna forma de juntarlos en una sola matriz?

Esta es una de las funciones que hacen los resultados, toman sus datos de una base de datos.

 function AddvotoTec(votor) { class Avg { constructor() {} static average(votor) { var total = 0; var count = 0; jQuery.each(votor, function(index, value) { total += value; count++; }); return total / count; } } var mvoti = Avg.average(votor); voti(mvoti); } function voti(Voti) { var voti = []; voti.push(Voti); console.log(voti); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Su problema es que pone var voti = [] en la función que inicializará una nueva matriz cada vez que la llame. Si desea enviar datos a esa matriz, debe sacarlos de voti(Voti)

 function AddvotoTec(votor) { class Avg { constructor() {} static average(votor) { var total = 0; var count = 0; jQuery.each(votor, function(index, value) { total += value; count++; }); return total / count; } } var mvoti = Avg.average(votor); voti(mvoti); } var voti = []; //move the array to the outer scope function voti(Voti) { voti.push(Voti); console.log(voti); }
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!