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

342
Views
copiar valores de una matriz a otra matriz

Quiero copiar los valores de genders[x] en otra matriz en JavaScript. Si géneros[x] es "m", quiero copiar los valores en una matriz separada que se llama géneros[m] y si es "f", quiero copiar los valores en la matriz géneros[f].

 m = 0; f = 0; x = 0; function add_element_to_array() { usernames[x] = document.getElementById("name").value; ages[x] = document.getElementById("age").value; genders[x] = document.getElementById("gender").value; gendersM[m] = document.getElementById("gender").value gendersF[f] = document.getElementById("gender").value if ( (correctEingabe == true) && (age == true) ){ ++x; if (genders[x] == "m") { ++m; } if (genders[x] == "f") { ++f; } else { deleteLastArray(); } }

La primera parte funciona perfectamente, así que solo esta parte es importante. Pero de alguna manera no funciona. Estaría muy agradecido por alguna ayuda.

 if (genders[x] == "m") { ++m; } if (genders[x] == "f") { ++f; }
over 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
Virtual assistant