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

171
Views
Error en mi tarea 4, parece que .checked y .value no parecen funcionar según lo previsto

Enlace a Scrimba para verificar el código: https://scrimba.com/scrim/czvrQJcM

Esencialmente, lo que debería suceder es que cuando se agregan los detalles y se hace clic en el botón, los datos primero se guardan en el objeto, "estudiante" y se insertan en la matriz. Luego se ejecuta la matriz y los nombres de los estudiantes se muestran en la página.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Acabo de resolver tu problema. Mira: En tu función enrolStudent() estableces la siguiente línea:

 studentList = studentList.push(student);

Por lo tanto, debe cambiarlo a:

 studentList.push(student);

Esto se debe a que el método push() devuelve la longitud de la matriz. Por lo tanto, no necesita atribuir el resultado de la operación a la matriz. El método ya actualizó su propio valor.

Task4 después del cambio:

 function enrolStudent() { let firstnameRef = document.getElementById("fname"); let lastnameRef = document.getElementById("lname"); let studentIdRef = document.getElementById("studentid"); let dateRef = document.getElementById("date"); let courseRef = document.getElementById("course"); let genderRef = document.getElementsByName("gender"); for (let i=0; i < genderRef.length; i++) { if (genderRef[i].checked) { var genderSelection = genderRef[i]; } } let student = new Object(); student.firstName = firstnameRef.value; student.lastName = lastnameRef.value; student.id = studentIdRef.value; student.course = studentIdRef.value; student.gender = genderSelection.value; student.date = dateRef.value; studentList.push(student); var val = studentList.push(student); studentEnrolSummaryRef.innerHTML = displayStudents(studentList); console.log(val); } ```
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!