Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

148
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda