Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

249
Vistas
ask from the command prompt to input data to all the entities, and it should give the option to add more than one entry at a time
<script>
  class Course {
    constructor(title, stream, type, start_date, end_date) {
      this.title = title;
      this.stream = stream;
      this.type = type;
      this.start_date = start_date;
      this.end_date = end_date;
      }
   }                                                                                                                                                                                                                                                                                        
  let newCourseInstance = new Course(
    window.prompt("Title:"),
    window.prompt("Stream:"),
    window.prompt("Type:"),
    window.prompt("Start date:"),
    window.prompt("End date:")
    );

Hello everyone!! i just want to ask something about an assignment that i should do. The application must ask from the command prompt to input data to all the entities, and it should give the option to add more than one entry at a time. Do you know how to do this iterration? Thank you for your time!!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can declare all the entities you want in an array and iterate this one and pass it to the class constructor.

      class Course {
        constructor(title, stream, type, start_date, end_date) {
         this.title = title;
         this.stream = stream;
         this.type = type;
         this.start_date = start_date;
         this.end_date = end_date;
       }
     }   

    const entities = ["Title:","Stream:","Type:","Start date:","End date:"]
    const data = entities.map(d => window.prompt(d))
    let newCourseInstance = new Course(data.join(',')); 

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda