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

170
Views
Cada vez que envío nuevos datos a la matriz de objetos, la propiedad del nombre se vuelve "indefinida"

A continuación se muestra la clase en la que trato de enviar nuevos datos a la matriz de objetos

 static addCustomer(input) { // buyTicket let data = Model.readCustomer(); let theaterId = Number(input[0]); let name = input[1]; let gender = input[2]; let seatNumber = input[3]; let ticketType = input[4]; let custId = 1; let theaterName = "xxi"; let movie = "movie"; if (data.length !== 0) { custId = data[data.length - 1].id + 1; } switch (theaterId) { case 1: theaterName = "Cinema 12"; movie = "Codezilla"; break; case 2: theaterName = "Bioskop IXX"; movie = "The Journey to Center of OOP"; break; case 3: theaterName = "Moviemaxx"; movie = "Avatar The Legend of Callback"; break; case 4: theaterName = "VGCinema"; movie = "Git The Kungfu Master"; break; case 5: theaterName = "Bioskop IXX"; movie = "Json The Protector"; break; default: break; } let newCustomer = new Customer( custId, name, gender, new Ticket(theaterName, ticketType, movie, seatNumber) ); data.push(newCustomer) console.log(data) }

Este es el resultado de console.log, observa que la propiedad de nombre de los datos anteriores se vuelve "indefinida" cada vez que intento enviar nuevos datos a la matriz.

captura de pantalla

A continuación se muestra mi clase "Cliente" en la que importo al archivo models.js

 class Customer { constructor(id, customerName, gender, ticket) { this.id = id; this.customerName = customerName; this.gender = gender; this.ticket = new Ticket( ticket.theaterName, ticket.type, ticket.movie, ticket.seatNumber ); } } class Ticket { constructor(theaterName, type, movie, seatNumber) { this.theaterName = theaterName; this.type = type; this.movie = movie; this.seatNumber = seatNumber; } }
about 4 years ago · Juan Pablo Isaza
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!