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

145
Vistas
JavaScript- making lists and more

Given the following assignment:

In JavaScript, you want to manage a list of exam registrations. To do this, it is necessary to create the Enrollment function, which acts as a constructor of the Objects of type Enrollment: these objects are characterized by a code, the date, the name of the teaching, the student's serial number from the date of the appeal. In addition, the PDP practice number (if the student has a recognized PDP) can be specified for an enrollment. Then create the SubscriptionList function, which acts as a constructor of objects that manage collections of inscriptions. A collection provides the following methods: addSubscription (which receives the Subscription object to be inserted), get (which receives the subscription code to be returned), and drop (which receives the subscription code to be deleted from the collection). This is what I have done for the first part:

function Inscription(code, date, subject, studentId, dateOfExam)

this.code= code;
this.date= date; 
this.subject = subject;
this.studentId = studentId;
this.dateOfExam = dateOfExam;

var MyList = new Array(); 
my.Inscription(new inscription( "W123", "010722", "JavaScript", "8410" , "010722"));

not sure about the rest thanks in advance

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

0

You started good, although the code you provided doesn't compile. let's fix that:

// added PDP
function Inscription(code, date, subject, studentId, dateOfExam, PDP) {
  this.code = code;
  this.date = date;
  this.subject = subject;
  this.studentId = studentId;
  this.dateOfExam = dateOfExam;
  this.PDP = PDP;
}

// var MyList = new Array();
// my.Inscription(new inscription("W123", "010722", "JavaScript", "8410", "010722"));
// this makes more sense: (note lower case upper case)
var inscription = new Inscription("W123", "010722", "JavaScript", "8410", "010722");
// anoher one:
var other_inscription = new Inscription("W124", "010722", "JavaScript 2", "8411", "010722");
// btw - why didn't you call it Enrollment?

// ok next is the SubscriptionList function 
function SubscriptionList() {
  var private_arr = []; // !

  // has the following methods:
  this.addSubscription = function(subscription) {
    private_arr.push(subscription);
  }

  this.get = function(subscription_code) {
    // ...
  }

  this.drop = function(subscription_code) {
    // ...
  }

  // let's add one more!
  this.toString = function() {
    return JSON.stringify(private_arr, null, 4)
  }
}

// new you can
var subscriptionList = new SubscriptionList();
subscriptionList.addSubscription(inscription);
subscriptionList.addSubscription(other_inscription);
subscriptionList.drop("W123");

console.log(subscriptionList.toString())
// good luck.
.as-console-wrapper {
  max-height: 100% !important;
}

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