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

135
Visualizações
Information won't show up in my console log

Code won't print in my console log. Why? I am trying to print things from a dataset but it won't print for some reason.

function totalPassengers(airportName) {
  var airport = getColumn("Busiest Airports", "Airport");
  var passengers = getColumn("Busiest Airports", "Total Passengers");
  for (var i = 0; i < airport.length; i++) {
    if (airport[i] == (airport[i] == airportName) ) {
return passengers[i];
    }
  }
}
console.log("The amount of passengers in this airport was: "+ getProperty("text_input1", "text") + totalPassengers());
function airport(airportName) {
  var airports = getColumn("Busiest Airports", "Airport Code");
  for (var i = 0; i < airports.length; i++) {
    if (airport[i] == airportName) {
      return (airports[i]);
    }
  }
}
console.log("The code of this airport is: " + airport);

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Not quite enough data from the code right now, but we can probably assume that the totalPassengers function should return the number of passengers at a certain airport.

I advise you to pay attention to the if condition. Because the condition if (airport[i] == (airport[i] == airportName)) is probably not correct, I think it should be something like if (airport[i] === airportName).

It seems to me that the first function should be like this:

function totalPassengers(airportName) {
  const airport = getColumn("Busiest Airports", "Airport");
  const passengers = getColumn("Busiest Airports", "Total Passengers");
  for (let i = 0; i < airport.length; i++) {
    if (airport[i] === airportName) {
       return passengers[i];
    }
  }
}

console.log(totalPassangers("NAME OF THE AIRPORT"));

As for the last line with console.log, you forgot to add the closing brackets and the argument.

console.log("The code of this airport is: " + airport("NAME OF THE AIRPORT"));
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